kamziro
kamziro

Reputation: 8140

Converting depth buffer into depth texture for GLSL

What is the easiest way to get the existing depth buffer into a depth texture, or anything that can be used by GLSL?

Is it possible to make a glsl shader that uses the depth buffer, and use it "as is" without having to modify the the way the original rendering is done (e.g modifying the frame buffer object to also render to an additional depth buffer etc)

Upvotes: 1

Views: 1056

Answers (1)

Dr. Snoopy
Dr. Snoopy

Reputation: 56357

Nope, you need to copy the depth buffer to a texture (somehow), or use a FBO to make the depth buffer a texture. There is no other way to read from the depth buffer in a shader.

Upvotes: 2

Related Questions