View Full Version : problems with alpha after glRotate

03-15-2004, 08:21 PM
Hello, I have a question about using alpha values. I have drawn many many triangles with varying alpha values and varying depths. To get the transparency effect I draw them in depth-sorted order. Now if I use glRotate to spin them around then I lose my transparency effect because I'm not drawing in depth-sorted order anymore. Is there a way to solve this, i.e. a way to rotate my object while maintaining transparencies?
Thanks in advance.

03-15-2004, 10:24 PM
You'll need to transform your polygons from model space to camera (or projection) space and sort them there. And yes, this is all done on the CPU. And yes, it's not a great solution, but that's pretty much all there is unless you're willing to take a whole bunch of rendering passes (if you are, then Google for "depth peeling", I think there's a paper on nVidia's dev website somewhere). The standard (and fast) solution is to transform and sort. Note: this only applies to alpha blended triangles, if your triangles are additive ( glBlend(GL_ONE,GL_ONE) ) then you can render them in any order.

03-22-2004, 12:26 AM
Many thanks for your reply.

I'm using glBlendFunc(GL_SRC_ALPHA, GL_ONE) because it's the one that's giving me the kind of effect I'm looking for. I found that simply disabling depth testing altogether solved my problem. I think this works because ALL my triangles need to be translucent, and they're also all the same color.