Sign in to follow this  

strange problom with masking

This topic is 4377 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello all. i am trying to mask and for some reason i can see the picture, it has white background and it has "holes" where is the real picture and i have no idea why. the code is glDisable(GL_DEPTH_TEST); glBlendFunc(GL_DST_COLOR,GL_ZERO); glEnable(GL_BLEND); glBindTexture(GL_TEXTURE_2D, texture[4]); glBegin(GL_QUADS); glTexCoord2f(1.0,1.0);glVertex3f(float(unit1[0]+6),float(unit1[1]+6),float(unit1[2])); glTexCoord2f(1.0,0.0);glVertex3f(float(unit1[0]+6),float(unit1[1]-6),float(unit1[2])); glTexCoord2f(0.0,0.0);glVertex3f(float(unit1[0]-6),float(unit1[1]-6),float(unit1[2])); glTexCoord2f(0.0,1.0);glVertex3f(float(unit1[0]-6),float(unit1[1]+6),float(unit1[2])); glEnd(); glBlendFunc(GL_ONE, GL_ONE); glBindTexture(GL_TEXTURE_2D, texture[3]); glBegin(GL_QUADS); glTexCoord2f(1.0,1.0);glVertex3f(float(unit1[0]+6),float(unit1[1]+6),float(unit1[2])); glTexCoord2f(1.0,0.0);glVertex3f(float(unit1[0]+6),float(unit1[1]-6),float(unit1[2])); glTexCoord2f(0.0,0.0);glVertex3f(float(unit1[0]-6),float(unit1[1]-6),float(unit1[2])); glTexCoord2f(0.0,1.0);glVertex3f(float(unit1[0]-6),float(unit1[1]+6),float(unit1[2])); glEnd(); glEnable(GL_DEPTH_TEST); glDisable(GL_BLEND); glDisable(GL_TEXTURE_2D); does anyone have any idea why this isnt working? thanks in advance

Share this post


Link to post
Share on other sites
try doing something like this

void draw()
{
glBegin(GL_QUADS);
glTexCoord2f(0,0); glVertex3f(0,0,0);
glTexCoord2f(1,0); glVertex3f(10,0,0);
glTexCoord2f(1,1); glVertex3f(10,10,0);
glTexCoord2f(0,1); glVertex3f(0,10,0);
glEnd();
}

and then do your masking like this

glEnable(GL_TEXTURE_2D)
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_DST_COLOR,GL_ZERO);
glBindTexture(GL_TEXTURE_2D,maskTexture);
draw();
glBlendFunc(GL_ONE,GL_ONE);
glBindTexture(GL_TEXTURE_2D,texture);
draw();
glDisable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glEnable(GL_DEPTH_TEST);


i believe your problem is that your calling the BlendFunc() before you have enable GL_BLEND.

let me know if it works

--nathan

Share this post


Link to post
Share on other sites

This topic is 4377 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this