🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Nehe Lesson 19

Started by
4 comments, last by Nomad3k 18 years, 1 month ago
Can someone please explain to me why, when I ammend Nehe's Lesson 19 and enable GL_DEPTH_TEST, all of a sudden the black borders from the particle.bmp start to appear. They are still semi transparent. I'm getting the feeling that the blending function is processing the particles nearest to farthest, rather than the other way around. Which is what is causing the problem. I should also point out that I increased the width of the particles from 1 to 10 in order to make the problem more apparent.
------------------------------------------------------------------ One step closer to total domination of the computer game market!------------------------------------------------------------------
Advertisement
enabling depth testing causes fragments that would normally pass through to be discarded due to the fragments of the particles quad being closer to the camera than they are. if part of the object being drawn after the quad where obscured by the particles quad, it would indeed outline that area.
As your leader, I encourage you from time to time, and always in a respectful manner, to question my logic. If you're unconvinced that a particular plan of action I've decided is the wisest, tell me so, but allow me to convince you and I promise you right here and now, no subject will ever be taboo. Except, of course, the subject that was just under discussion. The price you pay for bringing up either my Chinese or American heritage as a negative is - I collect your f***ing head.
So how do I make my particle emitter appear behind other geometry or particle emitters?
------------------------------------------------------------------ One step closer to total domination of the computer game market!------------------------------------------------------------------
You should disable writing to the Z-buffer while drawing transparent things, but still test for depth. And draw all transparent things last. This isn't perfect, but it's pretty close.
To disable writing to Z buffer use:
glDepthMask(FALSE);
Many thanks for that, and thanks for the layman's code at the bottom. :)
------------------------------------------------------------------ One step closer to total domination of the computer game market!------------------------------------------------------------------

This topic is closed to new replies.

Advertisement