Cargador de texturas para OpenGL. Más...
#include <OpenGLTextureMap.h>
Métodos públicos | |
GLuint | GetTextureID (string strTextureName, string strTextureBasePath, bool bIgnorePath, bool bClamp=false) |
Métodos públicos estáticos | |
static OpenGLTextureMap * | getInstance () |
Cargador de texturas para OpenGL.
Carga texturas en OpenGL y almacena los identificadores en un Map para su rapida reutilizacion.
OpenGLTextureMap * OpenGLTextureMap::getInstance | ( | ) | [static] |
Obtiene instancia del singleton
GLuint OpenGLTextureMap::GetTextureID | ( | string | strTextureName, | |
string | strTextureBasePath, | |||
bool | bIgnorePath, | |||
bool | bClamp = false | |||
) |
Devuelve el ID de la textura en OpenGL, devuelve 0 en caso de error. si bIgnorePath == true entonces solo se usara el nombre del archivo en strTextureName y se ignora el path del archivo (en caso de que tenga). Ej: en C:.jpg se usa textura1.jpg En caso bIgnorePath == false se usa strTextureName sin modificar. bClamp se utiliza para crear la textura en OpenGL. Si bClamp == false (por defecto) entonces la textura se crea con las propiedades glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT) y glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT) En caso que bClamp == false, en las propiedades anteriores en vez de GL_REPEAT se utiliza GL_CLAMP_TO_EDGE, esto es util para ciertos casos, por ejemplo para crear un skybox. strTextureBasePath indica la ubicacion desde la cual se buscara el nombre de la textura obtenido con los datos anteriores. Ej: si el nombre de la textura en la parte anterior es textura1.jpg y todas las texturas se encuantran en la carpeta "misTexturas", entonces si strTextureBasePath= "misTexturas" se buscara el archivo "misTexturas/textura1.jpg"