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

#include <GLTexture3D.h>

Public Member Functions

 GLTexture3D (GLint magFilter=GL_NEAREST, GLint minFilter=GL_NEAREST, GLint wrapX=GL_REPEAT, GLint wrapY=GL_REPEAT, GLint wrapZ=GL_REPEAT)
 Create an empty GL_TEXTURE_3D and set sampler parameters.
 ~GLTexture3D ()
 Destroy and delete the GL texture name.
 GLTexture3D (const GLTexture3D &other)
 Copy-construct and duplicate texture contents and parameters.
GLTexture3D & operator= (GLTexture3D other)
 Copy-assign and duplicate texture contents and parameters.
const GLuint getId () const
 Retrieve the OpenGL texture object name.
void clear ()
 Clear the texture to an empty image preserving dimensions/type.
void setEmpty (uint32_t width, uint32_t height, uint32_t depth, uint8_t componentCount, bool isFloat=false)
 Allocate an empty texture of given size and format.
void setData (const std::vector< GLubyte > &data, uint32_t width, uint32_t height, uint32_t depth, uint8_t componentCount=4)
 Upload unsigned-byte data with explicit dimensions.
void setData (const std::vector< GLubyte > &data)
 Upload unsigned-byte data using previously set dimensions.
void setData (const std::vector< GLfloat > &data, uint32_t width, uint32_t height, uint32_t depth, uint8_t componentCount=4)
 Upload 32-bit float data with explicit dimensions.
void setData (const std::vector< GLfloat > &data)
 Upload 32-bit float data using previously set dimensions.
const std::vector< GLubyte > & getDataByte ()
 Read back raw unsigned bytes via glGetTexImage.
const std::vector< GLfloat > & getDataFloat ()
 Read back raw floats via glGetTexImage.
Introspection
uint32_t getHeight () const
 Texture height (texels).
uint32_t getWidth () const
 Texture width (texels).
uint32_t getDepth () const
 Texture depth (texels).
uint32_t getComponentCount () const
 Components per texel (1..4).
uint32_t getSize () const
 Total number of elements (width*height*depth*components).
bool getIsFloat () const
 True if the storage/type is floating point.

Constructor & Destructor Documentation

◆ GLTexture3D() [1/2]

GLTexture3D::GLTexture3D ( GLint magFilter = GL_NEAREST,
GLint minFilter = GL_NEAREST,
GLint wrapX = GL_REPEAT,
GLint wrapY = GL_REPEAT,
GLint wrapZ = GL_REPEAT )

Create an empty GL_TEXTURE_3D and set 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_REPEAT).
wrapYGL wrap mode for T (y) coordinate.
wrapZGL wrap mode for R (z) coordinate.
Postcondition
A texture object is generated and the given parameters are applied.
Here is the caller graph for this function:

◆ ~GLTexture3D()

GLTexture3D::~GLTexture3D ( )

Destroy and delete the GL texture name.

◆ GLTexture3D() [2/2]

GLTexture3D::GLTexture3D ( const GLTexture3D & other)

Copy-construct and duplicate texture contents and parameters.

Here is the call graph for this function:

Member Function Documentation

◆ clear()

void GLTexture3D::clear ( )

Clear the texture to an empty image preserving dimensions/type.

Here is the call graph for this function:

◆ getComponentCount()

uint32_t GLTexture3D::getComponentCount ( ) const
inline

Components per texel (1..4).

◆ getDataByte()

const std::vector< GLubyte > & GLTexture3D::getDataByte ( )

Read back raw unsigned bytes via glGetTexImage.

◆ getDataFloat()

const std::vector< GLfloat > & GLTexture3D::getDataFloat ( )

Read back raw floats via glGetTexImage.

◆ getDepth()

uint32_t GLTexture3D::getDepth ( ) const
inline

Texture depth (texels).

◆ getHeight()

uint32_t GLTexture3D::getHeight ( ) const
inline

Texture height (texels).

Here is the caller graph for this function:

◆ getId()

const GLuint GLTexture3D::getId ( ) const

Retrieve the OpenGL texture object name.

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

◆ getIsFloat()

bool GLTexture3D::getIsFloat ( ) const
inline

True if the storage/type is floating point.

◆ getSize()

uint32_t GLTexture3D::getSize ( ) const
inline

Total number of elements (width*height*depth*components).

◆ getWidth()

uint32_t GLTexture3D::getWidth ( ) const
inline

Texture width (texels).

Here is the caller graph for this function:

◆ operator=()

GLTexture3D & GLTexture3D::operator= ( GLTexture3D other)

Copy-assign and duplicate texture contents and parameters.

Here is the call graph for this function:

◆ setData() [1/4]

void GLTexture3D::setData ( const std::vector< GLfloat > & data)

Upload 32-bit float data using previously set dimensions.

Parameters
dataInterleaved float pixels of size getSize()*sizeof(GLfloat).
Here is the call graph for this function:

◆ setData() [2/4]

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

Upload 32-bit float data with explicit dimensions.

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

◆ setData() [3/4]

void GLTexture3D::setData ( const std::vector< GLubyte > & data)

Upload unsigned-byte data using previously set dimensions.

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

◆ setData() [4/4]

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

Upload unsigned-byte data with explicit dimensions.

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

◆ setEmpty()

void GLTexture3D::setEmpty ( uint32_t width,
uint32_t height,
uint32_t depth,
uint8_t componentCount,
bool isFloat = false )

Allocate an empty texture of given size and format.

Parameters
widthWidth in texels.
heightHeight in texels.
depthDepth in texels.
componentCountComponents per texel (1..4).
isFloatIf true, allocate 32-bit float storage; otherwise unsigned byte.
Postcondition
Internal storage is allocated and initialized to zeros.
Here is the call graph for this function:
Here is the caller graph for this function:

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