Depth textures

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?

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.

[QUOTE=arekkusu;1248577]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.[/QUOTE]

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