Files Class List
GLTexture< TEXTURE_TYPE > Class Template Reference

Detailed Description

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

OpenGL texture base class.

This class provides a convenient interface for handling basic texture operations with OpenGL. The template argument TEXTURE_TYPE should be a texture type supported by OpenGL, such as GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D, GL_TEXTURE_CUBE_MAP, GL_TEXTURE_RECTANGLE, GL_TEXTURE_1D_ARRAY, GL_TEXTURE_2D_ARRAY, GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_BUFFER, GL_TEXTURE_2D_MULTISAMPLE, or GL_TEXTURE_2D_MULTISAMPLE_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 GLTexture< TEXTURE_TYPE >:

Public Member Functions

 GLTexture ()
 
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 ()
 

Constructor & Destructor Documentation

§ GLTexture()

GLTexture ( )

Constructor.

Member Function Documentation

§ Delete()

void Delete ( )

Deletes the texture.

§ GetID()

GLuint GetID ( ) const

Returns the texture ID.

§ IsNull()

bool IsNull ( ) const

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

§ Bind() [1/2]

void Bind ( ) const

Binds the texture to the current texture unit.

§ Bind() [2/2]

void Bind ( int  textureUnit) const

Binds the texture to the given texture unit.

§ Type()

GLenum Type ( ) const

Deletes the texture.

§ Initialize()

void Initialize ( )

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

§ BuildMipmaps()

void BuildMipmaps ( )

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

§ SetFilteringMode()

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.

§ SetAnisotropy()

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.

§ SetMaxAnisotropy()

void SetMaxAnisotropy ( )

Sets anisotropic filtering to the maximum permissible value.

§ SetNoAnisotropy()

void SetNoAnisotropy ( )

Turns off anisotropic filtering.