OpenGL sprite help
I'm making a sprite system for opengl; I can load the bitmaps (plural bitmaps, because there's an alpha mask) ok. I can make the quad ok. Then I render it. What is not ok is what happens when I try to draw other things on the screen. Even with an "alpha" component of 255 (completly on) weird things happen. For example, when I display a brown 16x16 quad after drawing a white rectangle, the white quad turns brown too. Here's the important parts of my code (tell me if there's something else I should include as important):
This is in my initalization code:
W and H are the width and heigth of the screen, respectivly.
This is how I create the texture:
w and h are the width and heigth of the texture, final_bmp is a pointer to the color+alpha chanel. f->tex is the tex id thingy.
/*Make the texture*/
Finally, I draw the texture like this:
x and y are the positions on the screen; they are representative of the upper left corner of the texture. f->h and f->w are the heigth and width of the texture, respectivly.
Please help me. I'm really lost right now. :confused:
Give them their own colors. Like for the box, you set it to white, then the squad with texture you set it to...whatever.
I should have shown the code that draws the white box. Here it is:
Before you draw the textured object color it full white, and before you draw the white box disable textures with glDisable(GL_TEXTURE_2D). Always keep in mind that OpenGL is a State Machine, so once you set a state, it remains that way until you change it.
That works! I'm one huge step closer to porting HIVE to opengl. Thank you.