View Full Version : Transparency Problems
09-01-2005, 05:48 PM
I'm using glDepthMask(GL_DISABLE) with alpha channels enabled to make objects with an alpha channel less than 1.0 look semi-transparent. But when I enable it, all the objects I've drawn are then displayed in the exact reverse order than they were originally drawn. (meaning, instead of displaying the first drawn object front-most, it's display the last drawn object front-most) Is it supposed to do that? Is there a better way of doing what I want, or am I a moron? :)
09-01-2005, 09:20 PM
I'm assuming you have a non-symmetric blend function.
If you think about your blend function, you're basically taking the background and mixing it in with the fragments you're rendering.
As such, the first thing you draw will effectively blend properly with the background. But subsequent overlapping objects will consider the current blended image as the new background, and blend on that.
So in effect, the first object you blended looks like it's the one that should be furthest away.
So when blending, you really want to draw the furthest object first, followed by the next-furthest object, etc, with the front-most object drawn last.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.