Files Class List
GLTexture3< TEXTURE_TYPE > Class Template Reference

Detailed Description

template<GLenum TEXTURE_TYPE>
class cy::GLTexture3< TEXTURE_TYPE >

OpenGL 3D texture class.

This class provides a convenient interface for handling 3D texture operations with OpenGL. The template argument TEXTURE_TYPE should be a 3D texture type supported by OpenGL, such as GL_TEXTURE_3D or GL_TEXTURE_2D_ARRAY. This class merely stores the texture id. Note that deleting an object of this class does not automatically delete the texture from the GPU memory. You must explicitly call the Delete() method to free the texture storage on the GPU.

#include <cyGL.h>

+ Inheritance diagram for GLTexture3< TEXTURE_TYPE >:

Public Member Functions

void SetImage (GLenum textureFormat, GLenum dataFormat, GLenum dataType, const void *data, GLsizei width, GLsizei height, GLsizei depth, int level=0)
 
template<typename T >
void SetImage (GLenum textureFormat, GLenum dataFormat, const T *data, GLsizei width, GLsizei height, GLsizei depth, int level=0)
 
template<typename T >
void SetImage (GL::Type textureType, const T *data, int numChannels, GLsizei width, GLsizei height, GLsizei depth, int level=0)
 
template<typename T >
void SetImage (const T *data, int numChannels, GLsizei width, GLsizei height, GLsizei depth, int level=0)
 
template<typename T >
void SetImageRGBA (GL::Type textureType, const T *data, GLsizei width, GLsizei height, GLsizei depth, int level=0)
 
template<typename T >
void SetImageRGB (GL::Type textureType, const T *data, GLsizei width, GLsizei height, GLsizei depth, int level=0)
 
template<typename T >
void SetImageRG (GL::Type textureType, const T *data, GLsizei width, GLsizei height, GLsizei depth, int level=0)
 
template<typename T >
void SetImageR (GL::Type textureType, const T *data, GLsizei width, GLsizei height, GLsizei depth, int level=0)
 
template<typename T >
void SetImageRGBA (const T *data, GLsizei width, GLsizei height, GLsizei depth, int level=0)
 
template<typename T >
void SetImageRGB (const T *data, GLsizei width, GLsizei height, GLsizei depth, int level=0)
 
template<typename T >
void SetImageRG (const T *data, GLsizei width, GLsizei height, GLsizei depth, int level=0)
 
template<typename T >
void SetImageR (const T *data, GLsizei width, GLsizei height, GLsizei depth, int level=0)
 
void SetWrappingMode (GLenum wrapS, GLenum wrapT, GLenum wrapR)
 
General Methods
void Delete ()
 
GLuint GetID () const
 
bool IsNull () const
 
void Bind () const
 
void Bind (int textureUnit) const
 
GLenum Type () const
 
Texture Creation and Initialization
void Initialize ()
 
void BuildMipmaps ()
 
void SetFilteringMode (GLenum magnificationFilter, GLenum minificationFilter)
 
void SetAnisotropy (float anisotropy)
 
void SetMaxAnisotropy ()
 
void SetNoAnisotropy ()
 

Member Function Documentation

§ SetImage() [1/4]

void SetImage ( GLenum  textureFormat,
GLenum  dataFormat,
GLenum  dataType,
const void *  data,
GLsizei  width,
GLsizei  height,
GLsizei  depth,
int  level = 0 
)

Sets the texture image using the given texture format, data format, and data type.

§ SetImage() [2/4]

void SetImage ( GLenum  textureFormat,
GLenum  dataFormat,
const T *  data,
GLsizei  width,
GLsizei  height,
GLsizei  depth,
int  level = 0 
)

Sets the texture image using the given texture format and data format. The data type is determined by the data pointer type.

§ SetImage() [3/4]

void SetImage ( GL::Type  textureType,
const T *  data,
int  numChannels,
GLsizei  width,
GLsizei  height,
GLsizei  depth,
int  level = 0 
)

Sets the texture image using the given texture type. The data format and type are determined by the data pointer type and the number of channels. The texture format is determined by the texture type and the number of channels.

§ SetImage() [4/4]

void SetImage ( const T *  data,
int  numChannels,
GLsizei  width,
GLsizei  height,
GLsizei  depth,
int  level = 0 
)

Sets the texture image. The texture format uses the matching data pointer type. If unsigned char is used, the texture uses 8-bit normalized values. If unsigned short is used, the texture uses 16-bit normalized values. If float is used, the texture uses non-normalized 32-bit float values. If char, short, or int is used, the texture uses non-normalized 8-bit, 16-bit, or 32-bit integer values.

§ SetImageRGBA() [1/2]

void SetImageRGBA ( GL::Type  textureType,
const T *  data,
GLsizei  width,
GLsizei  height,
GLsizei  depth,
int  level = 0 
)

Sets the texture image with 4 channels.

§ SetImageRGB() [1/2]

void SetImageRGB ( GL::Type  textureType,
const T *  data,
GLsizei  width,
GLsizei  height,
GLsizei  depth,
int  level = 0 
)

Sets the texture image with 3 channels.

§ SetImageRG() [1/2]

void SetImageRG ( GL::Type  textureType,
const T *  data,
GLsizei  width,
GLsizei  height,
GLsizei  depth,
int  level = 0 
)

Sets the texture image with 2 channels.

§ SetImageR() [1/2]

void SetImageR ( GL::Type  textureType,
const T *  data,
GLsizei  width,
GLsizei  height,
GLsizei  depth,
int  level = 0 
)

Sets the texture image with 1 channel.

§ SetImageRGBA() [2/2]

void SetImageRGBA ( const T *  data,
GLsizei  width,
GLsizei  height,
GLsizei  depth,
int  level = 0 
)

Sets the texture image with 4 channels.

§ SetImageRGB() [2/2]

void SetImageRGB ( const T *  data,
GLsizei  width,
GLsizei  height,
GLsizei  depth,
int  level = 0 
)

Sets the texture image with 3 channels.

§ SetImageRG() [2/2]

void SetImageRG ( const T *  data,
GLsizei  width,
GLsizei  height,
GLsizei  depth,
int  level = 0 
)

Sets the texture image with 2 channels.

§ SetImageR() [2/2]

void SetImageR ( const T *  data,
GLsizei  width,
GLsizei  height,
GLsizei  depth,
int  level = 0 
)

Sets the texture image with 1 channel.

§ SetWrappingMode()

void SetWrappingMode ( GLenum  wrapS,
GLenum  wrapT,
GLenum  wrapR 
)

Sets the texture wrapping parameter. The acceptable values are GL_REPEAT, GL_MIRRORED_REPEAT, GL_CLAMP, and GL_CLAMP_TO_BORDER. If the wrap argument is zero, the corresponding wrapping parameter is not changed.

§ Delete()

void Delete ( )
inherited

Deletes the texture.

§ GetID()

GLuint GetID ( ) const
inherited

Returns the texture ID.

§ IsNull()

bool IsNull ( ) const
inherited

Returns true if the OpenGL texture object is not generated, i.e. the texture id is invalid.

§ Bind() [1/2]

void Bind ( ) const
inherited

Binds the texture to the current texture unit.

§ Bind() [2/2]

void Bind ( int  textureUnit) const
inherited

Binds the texture to the given texture unit.

§ Type()

GLenum Type ( ) const
inherited

Deletes the texture.

§ Initialize()

void Initialize ( )
inherited

Generates the texture, only if the texture has not been previously generated. Initializes the texture sampling parameters.

§ BuildMipmaps()

void BuildMipmaps ( )
inherited

Builds mipmap levels for the texture. The texture image must be set first.

§ SetFilteringMode()

void SetFilteringMode ( GLenum  magnificationFilter,
GLenum  minificationFilter 
)
inherited

Sets the texture filtering mode. The acceptable values are GL_NEAREST and GL_LINEAR. The minification filter values can also be GL_NEAREST_MIPMAP_NEAREST, GL_LINEAR_MIPMAP_NEAREST, GL_NEAREST_MIPMAP_LINEAR, or GL_LINEAR_MIPMAP_LINEAR. If the filter argument is zero, the corresponding filter parameter is not changed.

§ SetAnisotropy()

void SetAnisotropy ( float  anisotropy)
inherited

Sets the anisotropy level of the texture. The anisotropy value of 1 disables anisotropic filtering. Larger values provide provide better anisotropic filtering.

§ SetMaxAnisotropy()

void SetMaxAnisotropy ( )
inherited

Sets anisotropic filtering to the maximum permissible value.

§ SetNoAnisotropy()

void SetNoAnisotropy ( )
inherited

Turns off anisotropic filtering.