LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: elias4444 on January 13, 2005, 16:58:13

Title: Z-plane drawing order
Post by: elias4444 on January 13, 2005, 16:58:13
I'm guessing there's a simple solution to this one, but I can't find it:

It took me a while to figure out that if I drew something with a higher z-plane coordinate before something that goes behind it, the first object's transparency wouldn't reflect the texture of the object behind it.  This makes sense, as you can't alphablend something that isn't there yet.

However, in 3D environments, it's hard to know what exactly is going to be closer to the camera and in front of something else at any given time. How do you handle this? Do you have to resort all of your objects every frame (wow, talk about a performance hit!), or is there a simple OpenGL function that does this for you (as I believe there is in DirectX).
Title: Z-plane drawing order
Post by: princec on January 13, 2005, 21:58:15
Yes, you need to resort your objects every frame. It's nowhere near as slow as you think.

Cas :)