Advertisement Jump to content
Sign in to follow this  

OpenGL, Blending and Depth Buffer

This topic is 4912 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I am just creating what I thought was a simple little demo. I have a solid object in the middle of the screen and I want to simulate bubbles rising around this "rock". So I made up a couple quick .tga files and made them mostly transparent and they look ok. So to simulate the bubbles rising around this rock, I am thinking perhaps a particle system would be the way to go, and use Alpha blending to get the "clear" look for the bubbles. So long story short... when using alpha blending, the correct way to draw on the screen is: 1) Enble Depth Buffer 2) Draw all non transparent objects first (the rock) 3) Enable Blending 4) Draw (alpha < 1.0f) objects to the screen in reverse order (lowest z first) 5) Disable Blending 6) Swap Buffers Does this sound about right? Thanks, Sam EDIT: The reason I ask is because I have seen a lot of demos on the net that do strange tricks with disabling the depth buffer, and these make no sense to me. I don't understand how they even get the desired effect.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!