Thanks in advance for any help.
I am trying to implement a simple tree in my game. I am using two rectangles textured with an image of a tree. The rectangles intersect each other, forming a + from above. The problem is the alpha portion of the first rectangle stays even after the second is rendered. Here is a picture: http://68.99.88.179:8080/screenshot.bmp
Here is the code:
// Turn on texture mapping if it’s not already
glEnable(GL_TEXTURE_2D);
// Bind
glBindTexture(GL_TEXTURE_2D, m_Texture);
/* Re-enable Blending */
glEnable( GL_BLEND );
//glBlendFunc(GL_ONE,GL_ONE);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REPLACE);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glPushMatrix();
glTranslatef(posx,groundy,posz);
glBegin(GL_QUADS); // Start drawing the side as a QUAD
//Assign the texture coordinates and vertices
glTexCoord2f(1.0f, 0.0f); glVertex3f(-width/2, 0, 0);
glTexCoord2f(1.0f, 1.0f); glVertex3f(-width/2, height, 0);
glTexCoord2f(0.0f, 1.0f); glVertex3f(width/2, height, 0);
glTexCoord2f(0.0f, 0.0f); glVertex3f(width/2, 0, 0);
glEnd();
glRotatef(90.0f,0.0f,1.0f,0.0f);
glBegin(GL_QUADS); // Start drawing the side as a QUAD
//Assign the texture coordinates and vertices
glTexCoord2f(1.0f, 0.0f); glVertex3f(-width/2, 0, 0);
glTexCoord2f(1.0f, 1.0f); glVertex3f(-width/2, height, 0);
glTexCoord2f(0.0f, 1.0f); glVertex3f(width/2, height, 0);
glTexCoord2f(0.0f, 0.0f); glVertex3f(width/2, 0, 0);
glEnd();
glPopMatrix();
glDisable( GL_BLEND );