I want to render a scene with an outline post processing effect in OpenGL ES 2.0.

First I render all the opaque objects. Then I use a post processing shader for silhouette detection that uses the depth buffer as a texture. And now I want to render all the objects using alpha blending, without writing to the depth buffer, but using depth testing with the values from the depth buffer texture used for silhouette detection.

If I would have rendered the translucent objects before the post processing, the post processing would have rendered the outlines of opaque objects over them since they don't write to the depth buffer.

How do you tell OpenGL ES 2.0 to use a texture as the depth buffer?

Thank you

  • 1
    \$\begingroup\$ If you want OpenGL to use an arbitrary texture for the depth buffer, this will be extremely difficult. However, if you use two FBOs each of which share the same depth attachment you are good to go. \$\endgroup\$ – Andon M. Coleman Sep 9 '13 at 0:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.