Tucano
0.1
A library for rapid prototyping with modern OpenGL and GLSL
|
Singleton class that manages texture unit allocation. More...
#include <texturemanager.hpp>
Public Member Functions | |
void | bindTexture (GLenum texType, GLuint texID, int texture_unit) |
Binds a texture to a unit given by the user. More... | |
int | bindTexture (GLenum texType, GLuint texID) |
Binds a texture to the first free texture unit and returns the allocated unit. More... | |
int | getAvailableUnit (void) |
Returns the first available texture unit. More... | |
void | setUnavailableUnit (int unit) |
Sets one unit as unavaiable. in case something besides the texture manager has bound a texture to it. More... | |
void | unbindTexture (GLenum texType, int texture_unit) |
Unbinds the texture from the specific texture unit. More... | |
void | unbindTextureID (GLenum texType, GLuint texID) |
Unbinds a texture with given ID Searches texture unit vector for the texture and frees unit. More... | |
~TextureManager () | |
Static Public Member Functions | |
static TextureManager & | Instance (void) |
Returns the unique instance. If no instace exists, it will create one (only once). More... | |
Private Member Functions | |
TextureManager () | |
Default Constructor. More... | |
TextureManager (TextureManager const &) | |
Copy Constructor. More... | |
TextureManager & | operator= (TextureManager const &) |
Assignment Operation. More... | |
Private Attributes | |
int | max_texture_units |
Maximum number of texture units. More... | |
std::vector< int > | used_units |
Texture units in use. each slot holds the texture id or -1 if free. More... | |
Static Private Attributes | |
static TextureManager * | pInstance |
Pointer to the instance of the Texture Manager object. More... | |
Singleton class that manages texture unit allocation.
When a texture is binded, this singleton will search for the first free slot to allocate it. This removes the burden of managing texture units inside the program.
|
inline |
|
inlineprivate |
Default Constructor.
|
inlineprivate |
Copy Constructor.
|
inline |
Binds a texture to a unit given by the user.
|
inline |
Binds a texture to the first free texture unit and returns the allocated unit.
|
inline |
Returns the first available texture unit.
|
inlinestatic |
Returns the unique instance. If no instace exists, it will create one (only once).
|
private |
Assignment Operation.
void Tucano::TextureManager::setUnavailableUnit | ( | int | unit | ) |
Sets one unit as unavaiable. in case something besides the texture manager has bound a texture to it.
|
inline |
Unbinds the texture from the specific texture unit.
|
inline |
Unbinds a texture with given ID Searches texture unit vector for the texture and frees unit.
texType | Texture type |
texID | The ID handler to given texture |
|
private |
Maximum number of texture units.
|
staticprivate |
Pointer to the instance of the Texture Manager object.
|
private |
Texture units in use. each slot holds the texture id or -1 if free.