My texture itself has a transparent background, and I would like to render it as-is.
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glPushMatrix();
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glTranslatef(x, y, 0.0f);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glVertexPointer(2, GL_FLOAT, 0, undoVertCoord);
glTexCoordPointer(2, GL_FLOAT, 0, undoTexCoord);
glBindTexture(GL_TEXTURE_2D, texUndo);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
The problem is with glColor4f
. That function seems to overwrite the transparency of the texture, making parts opaque when it should be transparent. But if I feed glColor4f with alpha value of 0, the whole texture becomes transparent.
SO, can you render a texture that ignores glColor4f, rendering the texture as-is? Or in a way that doesn't affect the alpha values?