Hello There,
I have been using OpenGL for a while now. Most of my games use a single texture with loads of sprites on it (spritesheet) and these get loaded using the following code:
//Draw
glBindTexture(GL_TEXTURE_2D, tex); ///Binds the Spritesheet Texture
glBegin(GL_POLYGON);
glTexCoord2f(tx, ty); glVertex2f(x,y);
glTexCoord2f(tx+32, ty); glVertex2f(x+32,y); ///The +32 is the W and H.
glTexCoord2f(tx+32, ty+32); glVertex2f(x+32,y+32);
glTexCoord2f(tx, ty+32); glVertex2f(x,y+32);
glEnd();
//Flip
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glScalef(1/uno, -1/dos, 1.0); ///Scales the Texture to make pixels accurate.
My problem is - when I use this, my Sprite’s have strange bleeding gaps (Bear in mind, I cannot use spaces due to toolkit limitations) - Here is a picture of the spritesheet and the game when run:
Spritesheet:
Game:
How do I fix this?
Thanks In Advance,
Matt
P.S - You guys have been a big help with my previous questions.