Hello,
I am displaying lines, text and a series of images (BMP) in a Glut window. I have loaded another static BMP at the bottom of the page which I am able to click on some of its sections to fast forward, zoom etc. Loading this image really slows down the program. Is there a way to speed up the execution while Preferably i can have mouse events on it? for example not loading the image every time (in Display() ) or not rendering the bottom of window? or any other ideas?

I am using the following subroutine to load the BMP files:

bool loadbmp(UINT textureArray[], LPSTR strFileName, int ID)//(NEW) the name of our function
{
if(!strFileName) return false;//If no file name was given then return a false value

AUX_RGBImageRec *pBitMap = auxDIBImageLoad(strFileName); //Load the file into a new variable where we can then manipulate it into our texture array
if(pBitMap == NULL) exit(0);// If no data was loaded then exit the program.

if (pBitMap) //If pBitMap still has a value then we want to clear it.
{
if (pBitMap->data)
{
free(pBitMap->data);
}
free(pBitMap);
}
return true;
}

Thanks in advance

ZbuffeR

01-29-2009, 02:59 AM

Well well...
you only need to call loadbmp once, at the start of the program.
Then, to select the texture to be drawn, simply call :
glBindTexture(GL_TEXTURE_2D, textureArray[0]); // change the texture array index when needed

_NK47

01-29-2009, 04:47 AM

wow, i dont even see a glDeleteTextures in your code, meaning your video ram will be trashed in no time. coding philosophy states that whenever you create something make sure to destroy it afterwards. as ZbuffeR said you need to create your texture only once (upload it to video ram), reuse it with glBindTexture and delete it when you done with it.