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