// for use when loading textures from .ctf (converted TGA file)
bool TextureMan::LoadTexture( const char * const fileName, const char * const textID )
{
	GLuint textureID;
	GLuint *pTextureID = &textureID;

	// get instance
	TextureMan *pTextMan = TextureMan::privGetInstance();

	unsigned char* lTexture = getTGAFile( fileName );
	pTextMan->privLoadMyTexture( lTexture, pTextureID );

	// hash the string textID and store it as the textureID for the manager
	MD5Output out;
	MD5Buffer ((unsigned char *)textID, strlen(textID), out);
	GLuint hashID = out.dWord_0 ^ out.dWord_1 ^ out.dWord_2 ^ out.dWord_3;

	// make a new node, set its values
	TextureNode *pNode = new TextureNode();
	pNode->set( fileName, hashID, textureID, GL_LINEAR, GL_LINEAR, GL_CLAMP_TO_EDGE );

	// add said node to front of active texture list
	pTextMan->privAddToFront( pNode, pTextMan->active );

	return true;
}
void TextureMan::AddTexture( const char * const inAssetName, const TextureName inName )
{
	GLuint textureID;
	GLuint *pTextureID = &textureID;

	// get instance
	TextureMan *pTextMan = TextureMan::privGetInstance();

	// load texture to gpu, get ID from gpu
	pTextMan->privLoadTexture( inAssetName, pTextureID );

	// make a new node, set its values
	TextureNode *pNode = new TextureNode();
	pNode->set( inAssetName, inName, textureID, GL_LINEAR, GL_LINEAR, GL_CLAMP_TO_EDGE );

	// add said node to front of active texture list
	pTextMan->privAddToFront( pNode, pTextMan->active );
}
Ejemplo n.º 3
0
void TextureMan::addTexture( const char * const _assetName, const TextureName _name)
{
	GLuint               textureID;
	GLuint *pTextureID = &textureID;

	// Get the instance to the manager
	TextureMan *pTextMan = TextureMan::privGetInstance();

	// Load the texture and get the textureID
	pTextMan->privLoadTexture( _assetName, pTextureID );

	// Create a TextureNode
	TextureNode *pNode = new TextureNode();

	// initialize it
	pNode->set( _assetName, _name, textureID, GL_LINEAR, GL_LINEAR, GL_CLAMP_TO_EDGE);

	// Now add it to the manager
	pTextMan->privAddToFront( pNode, pTextMan->active );
}