shadow2DProj problem

hello, I can’t get shadow2DProj and shadow2D functions to work in a depth comparison mode. Every time they return identical data as texture2D (with sampler set to sampler2D).

Please help and write me how to change depth comparison mode, to get above functions working correctly.

My system is Radeon 9700 so If it does not support depth comparison in GLSL then write me an info too.

Thanks!

Radeon 9700 does support (or at least should) depth comparison. My code (it works on 9800, yet I am not absolutely sure that everything is correct:):

texture creation:
glCopyTexImage2D(GL_TEXTURE_2D, 0,GL_DEPTH_COMPONENT, 0, 0, ShadowSize, ShadowSize, 0);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

glTexParameterf(GL_TEXTURE_2D, dglopengl.GL_TEXTURE_COMPARE_FAIL_VALUE_ARB,0.00);
glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE_ARB, GL_LUMINANCE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL);

Fragment program:

uniform sampler2DShadow ShadowTex;
varying vec4 TC1;
varying vec4 TC2;
varying vec4 TC3;

(…)

vec4 f1 = shadow2DProj(ShadowTex,TC1);
vec4 f2 = shadow2DProj(ShadowTex,TC2);
vec4 f3 = shadow2DProj(ShadowTex,TC3);

f = f1+f2+f3;
f = fc0.333;

I hope that’s what you were looking for…
Good luck!

Thanks for the reply. I’m sorry but I forgot to check the forum. I just were busy with other code parts. And since the problem is still unresolved I’ll check it today. I’m using compare instruction in the shader which I don’t want to use because I’m running out of ALU’s. I hope that your sugestions will help.

Cheers!

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