CGVIS Utils
Loading...
Searching...
No Matches
GLTextureCube Class Reference

OpenGL cube map texture (6 faces) with convenience upload helpers. More...

#include <GLTextureCube.h>

Public Member Functions

 GLTextureCube (GLint magFilter=GL_NEAREST, GLint minFilter=GL_NEAREST, GLint wrapX=GL_CLAMP_TO_EDGE, GLint wrapY=GL_CLAMP_TO_EDGE, GLint wrapZ=GL_CLAMP_TO_EDGE)
 Create an empty cube map and apply sampler parameters.
 ~GLTextureCube ()
 Destroy and delete the GL texture name.
 GLTextureCube (const Image &image0, const Image &image1, const Image &image2, const Image &image3, const Image &image4, const Image &image5, GLint magFilter=GL_NEAREST, GLint minFilter=GL_NEAREST, GLint wrapX=GL_REPEAT, GLint wrapY=GL_REPEAT)
 Construct and upload six faces from images.
 GLTextureCube (const GLTextureCube &other)
 Copy‑construct and duplicate texture contents and parameters.
GLTextureCube & operator= (const GLTextureCube &other)
 Copy‑assign and duplicate texture contents and parameters.
const GLuint getId () const
 Retrieve the OpenGL texture object name.
void clear ()
 Clear the texture by reinitializing the current storage.
void setEmpty (uint32_t width, uint32_t height, uint8_t componentCount, GLDataType dataType=GLDataType::BYTE)
 Allocate empty storage for all six faces.
void setData (const Image &image, Face face)
 Upload one face from an Image (unsigned bytes).
void setData (const std::vector< GLubyte > &data, uint32_t width, uint32_t height, Face face, uint8_t componentCount=4)
 Upload one face from unsigned‑byte data with explicit dimensions.
void setData (const std::vector< GLubyte > &data, Face face)
 Upload one face from unsigned‑byte data using existing dimensions.
void setData (const std::vector< GLfloat > &data, uint32_t width, uint32_t height, Face face, uint8_t componentCount=4)
 Upload one face from 32‑bit float data with explicit dimensions.
void setData (const std::vector< GLfloat > &data, Face face)
 Upload one face from 32‑bit float data using existing dimensions.
void setData (const std::vector< GLhalf > &data, uint32_t width, uint32_t height, Face face, uint8_t componentCount=4)
 Upload one face from 16‑bit half‑float data with explicit dimensions.
void setData (const std::vector< GLhalf > &data, Face face)
 Upload one face from 16‑bit half‑float data using existing dimensions.
void setFilter (GLint magFilter, GLint minFilter)
 Update filtering parameters on the bound cube map.
void generateMipmap ()
 Generate mipmaps for the cube map.
Introspection
uint32_t getHeight () const
 Face height in texels.
uint32_t getWidth () const
 Face width in texels.
uint32_t getComponentCount () const
 Components per texel (1..4).
uint32_t getSize () const
 Elements per face.
GLDataType getType () const
 Element type (BYTE/HALF/FLOAT).

Detailed Description

OpenGL cube map texture (6 faces) with convenience upload helpers.

Constructor & Destructor Documentation

◆ GLTextureCube() [1/3]

GLTextureCube::GLTextureCube ( GLint magFilter = GL_NEAREST,
GLint minFilter = GL_NEAREST,
GLint wrapX = GL_CLAMP_TO_EDGE,
GLint wrapY = GL_CLAMP_TO_EDGE,
GLint wrapZ = GL_CLAMP_TO_EDGE )

Create an empty cube map and apply sampler parameters.

Parameters
magFilterGL magnification filter (e.g., GL_NEAREST/GL_LINEAR).
minFilterGL minification filter (e.g., GL_NEAREST/GL_LINEAR).
wrapXGL wrap mode for S (x) coordinate (e.g., GL_CLAMP_TO_EDGE).
wrapYGL wrap mode for T (y) coordinate.
wrapZGL wrap mode for R (z) coordinate.
Postcondition
A GL texture object is generated and the given parameters are applied.
Here is the caller graph for this function:

◆ ~GLTextureCube()

GLTextureCube::~GLTextureCube ( )

Destroy and delete the GL texture name.

◆ GLTextureCube() [2/3]

GLTextureCube::GLTextureCube ( const Image & image0,
const Image & image1,
const Image & image2,
const Image & image3,
const Image & image4,
const Image & image5,
GLint magFilter = GL_NEAREST,
GLint minFilter = GL_NEAREST,
GLint wrapX = GL_REPEAT,
GLint wrapY = GL_REPEAT )

Construct and upload six faces from images.

Parameters
image0..image5Source images corresponding to faces; see setData(Image,Face).
magFilterGL magnification filter.
minFilterGL minification filter.
wrapXGL wrap mode for S.
wrapYGL wrap mode for T.
Note
Z wrap is left at the constructor default (R coordinate).
Here is the call graph for this function:

◆ GLTextureCube() [3/3]

GLTextureCube::GLTextureCube ( const GLTextureCube & other)

Copy‑construct and duplicate texture contents and parameters.

Here is the call graph for this function:

Member Function Documentation

◆ clear()

void GLTextureCube::clear ( )

Clear the texture by reinitializing the current storage.

Here is the call graph for this function:

◆ generateMipmap()

void GLTextureCube::generateMipmap ( )

Generate mipmaps for the cube map.

◆ getComponentCount()

uint32_t GLTextureCube::getComponentCount ( ) const
inline

Components per texel (1..4).

◆ getHeight()

uint32_t GLTextureCube::getHeight ( ) const
inline

Face height in texels.

◆ getId()

const GLuint GLTextureCube::getId ( ) const

Retrieve the OpenGL texture object name.

Returns
GLuint of the managed GL_TEXTURE_CUBE_MAP.
Here is the caller graph for this function:

◆ getSize()

uint32_t GLTextureCube::getSize ( ) const
inline

Elements per face.

◆ getType()

GLDataType GLTextureCube::getType ( ) const
inline

Element type (BYTE/HALF/FLOAT).

◆ getWidth()

uint32_t GLTextureCube::getWidth ( ) const
inline

Face width in texels.

◆ operator=()

GLTextureCube & GLTextureCube::operator= ( const GLTextureCube & other)

Copy‑assign and duplicate texture contents and parameters.

Here is the call graph for this function:

◆ setData() [1/7]

void GLTextureCube::setData ( const Image & image,
Face face )

Upload one face from an Image (unsigned bytes).

Parameters
imageSource image (bytes, interleaved).
faceDestination face.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setData() [2/7]

void GLTextureCube::setData ( const std::vector< GLfloat > & data,
Face face )

Upload one face from 32‑bit float data using existing dimensions.

Parameters
dataInterleaved floats of size getSize().
faceDestination face.
Here is the call graph for this function:

◆ setData() [3/7]

void GLTextureCube::setData ( const std::vector< GLfloat > & data,
uint32_t width,
uint32_t height,
Face face,
uint8_t componentCount = 4 )

Upload one face from 32‑bit float data with explicit dimensions.

Parameters
dataInterleaved floats of size componentCount*width*height.
widthWidth in texels.
heightHeight in texels.
faceDestination face.
componentCountComponents per texel (default 4 = RGBA).
Exceptions
GLExceptionif sizes do not match.
Here is the call graph for this function:

◆ setData() [4/7]

void GLTextureCube::setData ( const std::vector< GLhalf > & data,
Face face )

Upload one face from 16‑bit half‑float data using existing dimensions.

Parameters
dataInterleaved half‑floats of size getSize().
faceDestination face.

◆ setData() [5/7]

void GLTextureCube::setData ( const std::vector< GLhalf > & data,
uint32_t width,
uint32_t height,
Face face,
uint8_t componentCount = 4 )

Upload one face from 16‑bit half‑float data with explicit dimensions.

Parameters
dataInterleaved half‑floats of size componentCount*width*height.
widthWidth in texels.
heightHeight in texels.
faceDestination face.
componentCountComponents per texel (default 4 = RGBA).
Exceptions
GLExceptionif sizes do not match.
Here is the call graph for this function:

◆ setData() [6/7]

void GLTextureCube::setData ( const std::vector< GLubyte > & data,
Face face )

Upload one face from unsigned‑byte data using existing dimensions.

Parameters
dataInterleaved pixel bytes of size getSize().
faceDestination face.
Here is the call graph for this function:

◆ setData() [7/7]

void GLTextureCube::setData ( const std::vector< GLubyte > & data,
uint32_t width,
uint32_t height,
Face face,
uint8_t componentCount = 4 )

Upload one face from unsigned‑byte data with explicit dimensions.

Parameters
dataInterleaved pixel bytes of size componentCount*width*height.
widthWidth in texels.
heightHeight in texels.
faceDestination face.
componentCountComponents per texel (default 4 = RGBA).
Exceptions
GLExceptionif sizes do not match.
Here is the call graph for this function:

◆ setEmpty()

void GLTextureCube::setEmpty ( uint32_t width,
uint32_t height,
uint8_t componentCount,
GLDataType dataType = GLDataType::BYTE )

Allocate empty storage for all six faces.

Parameters
widthWidth in texels for each face.
heightHeight in texels for each face.
componentCountComponents per texel (1..4).
dataTypeElement type (BYTE/HALF/FLOAT).
Postcondition
Internal storage is allocated and initialized to zeros for all faces.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFilter()

void GLTextureCube::setFilter ( GLint magFilter,
GLint minFilter )

Update filtering parameters on the bound cube map.

Parameters
magFilterGL magnification filter.
minFilterGL minification filter.

The documentation for this class was generated from the following files: