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, void const *data, GLsizei width, GLsizei height, GLsizei depth, int level=0)
 Sets the texture image using the given texture format, data format, and data type.
 
template<typename T >
void SetImage (GLenum textureFormat, GLenum dataFormat, T const *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.
 
template<typename T >
void SetImage (GL::Type textureType, T const *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.
 
template<typename T >
void SetImage (T const *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.
 
template<typename T >
void SetImageRGBA (GL::Type textureType, T const *data, GLsizei width, GLsizei height, GLsizei depth, int level=0)
 Sets the texture image with 4 channels.
 
template<typename T >
void SetImageRGB (GL::Type textureType, T const *data, GLsizei width, GLsizei height, GLsizei depth, int level=0)
 Sets the texture image with 3 channels.
 
template<typename T >
void SetImageRG (GL::Type textureType, T const *data, GLsizei width, GLsizei height, GLsizei depth, int level=0)
 Sets the texture image with 2 channels.
 
template<typename T >
void SetImageR (GL::Type textureType, T const *data, GLsizei width, GLsizei height, GLsizei depth, int level=0)
 Sets the texture image with 1 channel.
 
template<typename T >
void SetImageRGBA (T const *data, GLsizei width, GLsizei height, GLsizei depth, int level=0)
 Sets the texture image with 4 channels.
 
template<typename T >
void SetImageRGB (T const *data, GLsizei width, GLsizei height, GLsizei depth, int level=0)
 Sets the texture image with 3 channels.
 
template<typename T >
void SetImageRG (T const *data, GLsizei width, GLsizei height, GLsizei depth, int level=0)
 Sets the texture image with 2 channels.
 
template<typename T >
void SetImageR (T const *data, GLsizei width, GLsizei height, GLsizei depth, int level=0)
 Sets the texture image with 1 channel.
 
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.
 
General Methods
void Delete ()
 Deletes the texture.
 
GLuint GetID () const
 Returns the texture ID.
 
bool IsNull () const
 Returns true if the OpenGL texture object is not generated, i.e. the texture id is invalid.
 
void Bind () const
 Binds the texture to the current texture unit.
 
void Bind (int textureUnit) const
 Binds the texture to the given texture unit.
 
GLenum Type () const
 Deletes the texture.
 
Texture Creation and Initialization
void Initialize ()
 Generates the texture, only if the texture has not been previously generated. Initializes the texture sampling parameters.
 
void BuildMipmaps ()
 Builds mipmap levels for the texture. The texture image must be set first.
 
void SetFilteringMode (GLenum magnificationFilter, GLenum minificationFilter)
 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.
 
void SetAnisotropy (float anisotropy)
 Sets the anisotropy level of the texture. The anisotropy value of 1 disables anisotropic filtering. Larger values provide provide better anisotropic filtering.
 
void SetMaxAnisotropy ()
 Sets anisotropic filtering to the maximum permissible value.
 
void SetNoAnisotropy ()
 Turns off anisotropic filtering.