PDA

View Full Version : depth compare results in alpha layer



Archimedes3.14
10-17-2003, 08:14 AM
Hi All,

I am having problems getting the filtered result of Depth comparisons of the shadowmap in the alpha layer.

My shadowmap looks like this...

glBindTexture(GL_TEXTURE_2D, m_texShadowMap);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_COMPARE_M ODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_COMPARE_F UNC_ARB, GL_LEQUAL);
glTexImage2D(GL_TEXTURE_2D, 0,GL_DEPTH_COMPONENT16_ARB , m_nShadowMapSize[0], m_nShadowMapSize[1],0,GL_DEPTH_COMPONENT,GL_FLOAT,NULL);

if I use

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_COMPARE_M ODE_ARB,GL_ALPHA )

it doesn't work. And if I try to send it from the RGB layer to Alpha with the combiners like it is the same problem.

glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE0_ALPHA_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND0_ALPHA_ARB, GL_SRC_COLOR);

I'll be glad if i can find a solution to this...

V-man
10-19-2003, 11:10 AM
I think you mean this :

glTexParameteri(GL_TEXTURE_2D,GL_DEPTH_TEXTURE_MOD E_ARB, GL_ALPHA )

be sure to use glGetError

Archimedes3.14
10-19-2003, 04:12 PM
Thanks... this is definitely compliant with the chaos theory,i.e., little things can cause huge differences.

It works! But I still don't understand why I couldn't transfer RGB values of shadowmap to alpha values in the next texture unit using texture combiners.

Is there a good book on the latest extensions in OpenGL?


Originally posted by V-man:
I think you mean this :

glTexParameteri(GL_TEXTURE_2D,GL_DEPTH_TEXTURE_MOD E_ARB, GL_ALPHA )

be sure to use glGetError