PDA

View Full Version : Blending



DPalomo
06-20-2000, 03:39 AM
Hi all,

does someone know if it is possible to use different blending techniques (like

glBelndFunc(GL_ONE, GL_ZERO); or

glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA)) without one interfering with the other?
Or maybe it has a fixed calling sequence like:



glEnable(GL_BLEND);
glBlendFunc(...);
// Draw something
glDisable(GL_BLEND);


My problem is that when a particular

glBlendFunc() is used, I cannot change this blending for the same scene.

Thanx in advance http://www.opengl.org/discussion_boards/ubb/smile.gif,

Daniel Palomo van Es

DFrey
06-20-2000, 07:02 AM
If you are asking what I think your are asking, sure you can. But it takes a bit more work. First you draw all opaque objects. Next, you need to depth sort all transparent or filtered polygons. And then to be absolutely perfect you should split intersecting transparent polygons so that the depth sorting can be perfect (I rarely do the splitting since things tend to constantly move in my apps and the flaw isn't really noticeable, for largely static scenes I would do the splitting.) Then draw all the transparent polygons from far to near with depth writes disabled, but depth testing enabled.