Hi
I have read numerous threads on other people having similar probs and have tried all solutions and none seem to work. I am trying to draw a texture to the screen with one of the textures colors fully transparent. It works perfectly if I draw the image to the screen using glDrawPixels() and passing parameter RGBA, but when trying to do the same thing using a texture it doesnt. I have passed RGBA as a parameter in the glTexImage2D() call. I have the following setup:
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
I have no idea what the problem is! The Alpha bits are obviously setup correctly because as I say if I use drawpixels it works. The Texture appears but as I say the parts I want to be transparent aren’t.
Here is whats written:
glEnable(GL_TEXTURE_2D);
glPushMatrix();
glLoadIdentity();
//glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REPLACE);
gluOrtho2D(0.0,700.0,0.0,550.0);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glTranslatef(200.0f,200.0f,0.0f);
glRotatef(Rot,0.0,0.0,1.0);
glTranslatef(0.0f,0.0f,0.0f);
glPolygonMode( GL_FRONT, GL_FILL );
glBegin(GL_QUADS);
// Front face
glTexCoord2f(0.0f, 0.0f); glVertex3f(-32,-32, 0); // Bottom left of the texture and quad
glTexCoord2f(1.0f,0.0f); glVertex3f( 32,-32, 0); // Bottom right of the texture and quad
glTexCoord2f(1.0f,1.0f); glVertex3f( 32,32, 0); // Top right of the texture and quad
glTexCoord2f(0.0f, 1.0f); glVertex3f(-32,32, 0); // Top left of the texture and quad
glEnd();
glPopMatrix();
glDisable(GL_TEXTURE_2D);
glRasterPos2i(Rb1X-Rb1HWidth,Rb1Y-Rb1HHeight);
glPixelStorei(GL_UNPACK_ALIGNMENT,4);
glDrawPixels(Rb1Width,Rb1Height,GL_RGBA,GL_UNSIGNED_BYTE,Pixels);
Please Help!!
Thanks…
Rohland