hey guys,
I have a problem with a program I'm creating. Basically for every user input a string is created which is the name of the image. Now all of the images have already been loaded as textures (gltexture) with relevant names such as dog.jpg is loaded as a gltexture whose id is dog. I need to texture map these images to various shapes, for now we'll say a rectangle (GL_Quad). However all I have to identify the texture needed is the string. Therefore is there anyway to convert the string into a format which allows me to indentify the texture needed e.g.
string = dog
string to someformat
glBindTexture(GL_TEXTURE_2D, someformat.TextureID);
Right now I am using the string to create the filepath so string = dog is becoming string = c:/images/dog.jpg, I'm then using this path to load the texture each time and bind it. However as the image is redrawn all the time it is constantly loading the texture over and over which is killing cpu usage. I hope this all makes sense, if it isnt possible any ideas on alternative methods would be appreciated. Thanks.


LinkBack URL
About LinkBacks
Reply With Quote
