A simple question


The format of my depth texture is GL_DEPTH_COMPONENT but when I’m reading the texture in fragment program I have a rgba value. So what is the solution to get the correct floating value which is in the depth texture ?
float depth = texture2D(myTexture, vec2(gl_TexCoord[0])).x; ?


AFAIK if texture format is GL_DEPTH_FORMAT you can access the textures depth with .x (just like your example).

ok thanks

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.