03-11-2005, 02:52 PM
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.
03-12-2005, 01:43 AM
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:):
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);
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);
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 = f*c*0.333;
I hope that's what you were looking for...
03-17-2005, 12:45 AM
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.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.