Ok, sorry for double posting, but I really got a problem. I filled the texture up now to get a loadable size, so the bitmaps size is now 256x32. With the following code, the animation gets displayed:
glBegin(GL_QUADS);
glTexCoord2f(((1.0f/handle->framesx)*
(frame+1)),1.0f);
glVertex2d(hsx,-hsy);
glTexCoord2f(((1.0f/handle->framesx)*
(frame)),1.0f);
glVertex2d(-hsx,-hsy);
glTexCoord2f(((1.0f/handle->framesx)*
(frame)),0.0f);
glVertex2d(-hsx,hsy);
glTexCoord2f(((1.0f/handle->framesx)*
(frame+1)),0.0f);
glVertex2d(hsx,hsy);
glEnd();
The code for glTexCoord2f is pretty simple. I take the whole width of the bitmap (1.0f), divide it through the number of frames (framesx) and multiply it with the frame I want to display.
But now, I only want to use a width of 192 pixels of the 256 pixels inside the texture for my animation. Therefore I changed the glTexCoord2f code as follows:
glBegin(GL_QUADS);
glTexCoord2f(((handle->borderfac/handle->framesx)*(frame+1)),1.0f);
glVertex2d(hsx,-hsy);
glTexCoord2f(((handle->borderfac/handle->framesx)*(frame)),1.0f);
glVertex2d(-hsx,-hsy);
glTexCoord2f(((handle->borderfac/handle->framesx)*(frame)),0.0f);
glVertex2d(-hsx,hsy);
glTexCoord2f(((handle->borderfac/handle->framesx)*(frame+1)),0.0f);
glVertex2d(hsx,hsy);
glEnd();
The only thing that changed is glTexCoord2f. It doesn’t divide 1.0f now, it divides the floatvalue borderfac, which holds the value (192/256=0.75f).
But now my texture isn’t displayed anymore. Maybe I make a mistake in thinking but normaly, my code should be right?
Can somebody help me?
I’m pretty confused
Thank you