Reading the Z-buffer value in a post process pass?

Started by
1 comment, last by Expandable 18 years, 1 month ago
how can I read the z-buffer value form a post process path? is there somehow to access the current z-buffer value or will I have to add a new path where I render Z to a floating point texture?
Advertisement
Quote:Original post by Code-R
how can I read the z-buffer value form a post process path? is there somehow to access the current z-buffer value or will I have to add a new path where I render Z to a floating point texture?
You can use glReadPixels with format set to GL_DEPTH_COMPONENT to access the current depth buffer values. It may not be the fastest operation though. I would suggest rendering depth to a texture, making use of multiple render targets if they are available to you.
Using the EXT_FRAMEBUFFER_OBJECTS extension is probably the best way to do this... and it should be supported on all recent graphics cards.

This topic is closed to new replies.

Advertisement