Jump to content
  • Advertisement
Sign in to follow this  
Muncher

OpenGL lay down z

This topic is 5117 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

just wondering how you would implement the 'laying down the z' pass in opengl - would you render the scene without textures/lights and color buffer writes disabled, then switch the glDepthFunc() to GL_EQUAL, then draw the scene as usual??

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Muncher
just wondering how you would implement the 'laying down the z' pass in opengl - would you render the scene without textures/lights and color buffer writes disabled, then switch the glDepthFunc() to GL_EQUAL, then draw the scene as usual??


yep you got it, disable color writes, enable z writes, draw the scene, depth function to equal, enable color writes, disable z writes, redraw.

This is only useful if you are fillrate limited, if you are geometry limited you will suffer a performance loss.

Share this post


Link to post
Share on other sites
cheers, thanks!

Yer im fillrate limited, the world is partitioned in an octree and i think there are heaps of extra fragments being generated (and shaded) - so the fps are quite low.

Share this post


Link to post
Share on other sites
hmmm 'think' is a dangerous word when it comes to this kinda thing, i'd make sure its the case instead of guessing thats where the problem is. The performance pdf in my sig has a nice flow chart which covers the steps you should follow (as required) to insure thats the problem.

Also, the switch to GL_EQUAL isnt required, GL_LEQUAL will do the same job and ATI advice staying away from GL_EQUAL depth test and both say its not a great idea to switch depth tests part way through a frame (pg 20 of the pdf), so you are probably better off staying with GL_LEQUAL.

Also, remember fillrate isnt just how much you are writing to the screen, its also effected by texture sizes, compression, filtering modes and any fragment programs you might have active.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!