Archived

This topic is now archived and is closed to further replies.

more blending questions....

This topic is 5147 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

Ok, so I''ve more or less got blending mastered - the problem being that either way I create my transparent objects odd things happen.... if I create the transparent object before everthing else then the transparentness is only really visible against a black background - it has no effect on the textured objects created after it. If I create the blended object after everything else it''s fine as long as you''re looking through the transparent object at something else - if you''re on the other side of something else looking in the direction of the transparent object then the object you are looking at is also transparent - even though it''s not supposed to be. Can anyone help me?!? Andy

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I''ve had this problem before too, but I forget how I fixed it, lemme go back & look at some things, but I think it involves enabling & disabling:

blending & depth testing

at the right times.

Share this post


Link to post
Share on other sites

// some where in GL init function:
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

// in the rendering function
glDepthMask(GL_TRUE);
// draw solid objects here
glDepthMask(GL_FALSE);
glEnable(GL_BLEND);
// draw transparent objects here
glDisable(GL_BLEND);


[edited by - glUser3f on November 7, 2003 4:53:24 PM]

[edited by - glUser3f on November 9, 2003 4:35:47 PM]

Share this post


Link to post
Share on other sites
this is a common issue with blending. to have alpha, u usually need to render alpha-objects after all else in the scene. but to preserve depth data accurately, u need to enable depth buffer but disable depth buffer writes when u''re rendering the translucent objects. i dunno if the search is working, but if it does then u shud be able to find a lot of posts on this topic.

Share this post


Link to post
Share on other sites