Files Class List

Detailed Description

OpenGL cube map texture class.

This class provides a convenient interface for handling cube map texture operations with OpenGL. 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 GLTextureCubeMap:

Public Types

typedef GLTextureCubeMapSide Side
 Sides of the cube map.
 

Public Member Functions

void SetImage (Side side, GLenum textureFormat, GLenum dataFormat, GLenum dataType, void const *data, GLsizei width, GLsizei height, int level=0)
 Sets the texture image using the given texture format, data format, and data type.
 
template<typename T >
void SetImage (Side side, GLenum textureFormat, GLenum dataFormat, T const *data, GLsizei width, GLsizei height, 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 (Side side, GL::Type textureType, T const *data, int numChannels, GLsizei width, GLsizei height, 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 (Side side, T const *data, int numChannels, GLsizei width, GLsizei height, 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 (Side side, GL::Type textureType, T const *data, GLsizei width, GLsizei height, int level=0)
 Sets the texture image with 4 channels.
 
template<typename T >
void SetImageRGB (Side side, GL::Type textureType, T const *data, GLsizei width, GLsizei height, int level=0)
 Sets the texture image with 3 channels.
 
template<typename T >
void SetImageRG (Side side, GL::Type textureType, T const *data, GLsizei width, GLsizei height, int level=0)
 Sets the texture image with 2 channels.
 
template<typename T >
void SetImageR (Side side, GL::Type textureType, T const *data, GLsizei width, GLsizei height, int level=0)
 Sets the texture image with 1 channel.
 
template<typename T >
void SetImageRGBA (Side side, T const *data, GLsizei width, GLsizei height, int level=0)
 Sets the texture image with 4 channels.
 
template<typename T >
void SetImageRGB (Side side, T const *data, GLsizei width, GLsizei height, int level=0)
 Sets the texture image with 3 channels.
 
template<typename T >
void SetImageRG (Side side, T const *data, GLsizei width, GLsizei height, int level=0)
 Sets the texture image with 2 channels.
 
template<typename T >
void SetImageR (Side side, T const *data, GLsizei width, GLsizei height, int level=0)
 Sets the texture image with 1 channel.
 
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.
 

Static Public Member Functions

static void SetSeamless (bool enable=true)
 Sets the global seamless cube mapping flag, if supported by the hardware.