I'm using CEGUI as the GUI for an OpenGL game. CEGUI loads and I'm guessing loads each texture it requires as a GL_TEXTURE_2D?
It most definately gives each texture an ID number starting from 0, incrementing each time an new image is loaded?
Now after the user has selected a level to play, my game (which has been coded entirely from scratch by myself), loads each model it requires into memory with each corresponding texture giving each texture an ID which also starts from 0.
Now CEGUI goes to render, binds a texture to draw the GUI coponent with and lo, the GUI gets painted with my textures rather than the ones CEGUI actually wants, this is because the game textures have effectively overwritten the CEGUI ones by using the same ID numbers.
What I want:
Is a way to get the next available texture ID according to CEGUI to start numbering my textures from.... I know this will work because I've done an ugly hack where I add 10 to each of my new texture ID's, unfortunately this isn't ideal I would like a much more elegant way of doing it.
Any suggestions? Or have I missed the point?
Thanks
LWD
----------
Edit
----------
For those of you who are as idiotic as I am, you can use the glGenTextures() method to get an unused texture object identifier... doh!
The code:
Code: Select all
int TextureManager::getNewTextureID (void)
{
unsigned int textureObject[1]; //Define an array of unsigned int of length 1
glGenTextures(1,textureObject); //Get 1 unused texture object
int index = (int)textureObject[0]; //Cast the usi as an int to stop annoying warning messages
return index; //Return the unique unused identifier
}