Depth Comparison Problem

When i was learning Depth peeling . i confused with the fellowing code,The texture comparison mode is GL_COMPARE_R_TO_TEXTURE_ARB

"TEX R0.x, fragment.position, texture[0], SHADOWRECT;

Texture buffer texture[0] contains the contents of the depth buffer from the previous level, against which the depth of the current fragment is compared. Performing a shadow-mapping comparison (as designated by the SHADOWRECT keyword) returns a binary result
Dose it compare fragment.position.z with depth texture? if so,where is the texcoord to access the texture[0]? is it fragment.position.xy play the role of texcoord?but position.xy can be negative . Can someone explain how does this code work?

If you read the ARB_fragment_program specification, you’ll see that fragment.position contains window coordinates. So .xyz will never be negative.

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