Hello all great board lots of stuff to be learned here!
I have been having this issue for a while now and I can’t seem to resolve it. I have an object that I am creating partly transparent via the texture. To do this I am masking, applying the texture I want to be seen, and a texture that has black where I want the texture solid and white where I want it transparent. It works great when there is no light enabled, but fails when light is. Well… not really the object is 2D and the side I make the normal on works fine when there is light on it, but not the other side.
Maybe a screenshot would help:
And my code:
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glDisable (GL_DEPTH_TEST);
glBlendFunc (GL_DST_COLOR, GL_ZERO);
glBindTexture (GL_TEXTURE_2D, texture[0]);
glBegin (GL_QUADS);
glNormal3f(0,0,1);
glTexCoord2d (0, 0);
glVertex3f (-1, -1, 0);
glTexCoord2d (1, 0);
glVertex3f (1, -1, 0);
glTexCoord2d (1, 1);
glVertex3f (1, 1, 0);
glTexCoord2d (0, 1);
glVertex3f (-1, 1, 0);
glEnd();
glBlendFunc(GL_ONE, GL_ONE);
glBindTexture(GL_TEXTURE_2D, texture[1]);
glBegin (GL_QUADS);
glNormal3f(0,0,1);
glTexCoord2d (0, 0);
glVertex3f (-1, -1, 0);
glTexCoord2d (1, 0);
glVertex3f (1, -1, 0);
glTexCoord2d (1, 1);
glVertex3f (1, 1, 0);
glTexCoord2d (0, 1);
glVertex3f (-1, 1, 0);
glEnd();
glEnable(GL_DEPTH_TEST);
Could someone please help me? Thank you.