PDA

View Full Version : Depth textures



debonair
02-27-2013, 02:55 AM
I have implemented depth texture and getting different outputs on 2 different drivers.
I am reading all channels in texture() in fragment shader :

“color = color + texelFetch(tk_diffuseMap, ivec3(tmp), i);”

In this case I get a red and grey image on A and B respectively. If I read red channel and replicate it to all the 4 channels I get a grey image on A like:

“color = color + vec4(texelFetch(tk_diffuseMap, ivec3(tmp), i).x)”.

Which one is correct?

arekkusu
02-27-2013, 12:19 PM
This depends on your context version, profile, and possibly DEPTH_TEXTURE_MODE.

In Compatibility profile, or in an ancient GL2 context, DEPTH_TEXTURE_MODE defaults to LUMINANCE, so the expected result is grey.
In Core Profile, LUMINANCE and DEPTH_TEXTURE_MODE are deprecated, so the expected result is red.

debonair
02-27-2013, 09:55 PM
This depends on your context version, profile, and possibly DEPTH_TEXTURE_MODE.

In Compatibility profile, or in an ancient GL2 context, DEPTH_TEXTURE_MODE defaults to LUMINANCE, so the expected result is grey.
In Core Profile, LUMINANCE and DEPTH_TEXTURE_MODE are deprecated, so the expected result is red.

Thanks. I am using core profile which means it should be red.