fastest method of writing depth

whats the fastest method of writing depth info into a texture WRT texture data saying if u write the depthfragment or not?
ie if the textures alpha is 0.0 then dont write depth
if its 1.0 then write depth

ta zed

GL_ALPHA_TEST.
Or do you mean still render the color but not the depth on those fragments?

no only the depth (this is for a depth texture)
ALPHA TEST would be ideal but
the problem with ALPHA_TEST is i believe it disables early depth rejection thus is slow (1/2 speed) or is this wrong?

>> problem with ALPHA_TEST is i believe it disables early depth rejection thus is slow

Thinking about it, there is quite a lot of optimization can’t do if you need to access texture data for writing depth …

Originally posted by zed:
ALPHA TEST would be ideal but
the problem with ALPHA_TEST is i believe it disables early depth rejection thus is slow (1/2 speed) or is this wrong?

It will be disabled regardless if you use alpha test, kill the fragment in the shader or modify the depth in the shader. I don’t see any other way to solve the problem so I’m afraid you’re out of luck. But it may not be that bad if you don’t have a lot of overdraw or only use do this for a subset of the rendering.

so it looks like i stick to what i already have i was hoping for some trickery
anyways thanks guys