depth compare results in alpha layer

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_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_COMPARE_FUNC_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_MODE_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…

I think you mean this :

glTexParameteri(GL_TEXTURE_2D,GL_DEPTH_TEXTURE_MODE_ARB, GL_ALPHA )

be sure to use glGetError

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:
[b]I think you mean this :

glTexParameteri(GL_TEXTURE_2D,GL_DEPTH_TEXTURE_MODE_ARB, GL_ALPHA )

be sure to use glGetError[/b]