PDA

View Full Version : A simple question



pantxua
05-29-2004, 12:13 AM
hi,

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; ?

thanks

Corrail
05-29-2004, 03:06 AM
AFAIK if texture format is GL_DEPTH_FORMAT you can access the textures depth with .x (just like your example).

pantxua
05-29-2004, 03:11 AM
ok thanks