views:

85

answers:

1

Hey all, I'm working on creating a hole in a wall using masking in opengl, my code is quit simple like this,

//Draw the mask
glEnable(GL_BLEND);                         
glBlendFunc(GL_DST_COLOR,GL_ZERO);  
glBindTexture(GL_TEXTURE_2D, texture[3]);

glBegin(GL_QUADS);
glTexCoord2d(0,0); glVertex3f(-20,40,-20);
glTexCoord2d(0,1);glVertex3f(-20,40,40);
glTexCoord2d(1,1);glVertex3f(20,40,40);
glTexCoord2d(1,0);glVertex3f(20,40,-20);

glEnd();

//Draw the Texture
glBlendFunc(GL_ONE, GL_ONE);


glBindTexture(GL_TEXTURE_2D, texture[2]);
glBegin(GL_QUADS);
glTexCoord2d(0,0); glVertex3f(-20,40,-20);
glTexCoord2d(0,1);glVertex3f(-20,40,40);    
glTexCoord2d(1,1);glVertex3f(20,40,40);
glTexCoord2d(1,0);glVertex3f(20,40,-20);
glEnd();

The problem is, I got the hole in the wall correctly but it's semi transparent, I'm getting like black shade over it, also I can see through it. Here's a photo for what I'm getting: alt text

any suggestions?

A: 

SOLVED :D It was a problem with the surfaces' Normals, once I set the normals in the correct position.The black shade faded out.

Shaza
Feel free to accept your own answer!
Xavier Ho