depthfunc

Is there a way to draw everywhere where never has been drawn to (this frame) ?

For example: I´d like to draw a fullscreen quad, but only where no other geomtry has been drawn. I know i can do that by first drawing the quad (depth test disabled) and then drawing the geometry, but this hits hard on fillrate.

So is there a way? glDepthFunc doesn´t seem to provide this.

Jan.

I’d simply draw a full-screen quad, with Z-test enabled, and a Z value as far as possible.

Y.

DepthFunc(GREATER) and DepthRange(0.99999,1) seems like a relatively easy way.

Or you could use the stencil buffer, although that seems a little wasteful.

Why not draw the stuff that’s going to where there haven’t been anything drawn first? Draw that first with depth test disabled and draw the rest of the scene on top of that.

Originally posted by jwatte:
[b]DepthFunc(GREATER) and DepthRange(0.99999,1) seems like a relatively easy way.

Or you could use the stencil buffer, although that seems a little wasteful.[/b]

Or a DepthFunc(EQUAL) and a DepthRange(1,1).

Cass,

I considered that, but chickened out because I’m sure there are drivers that wouldn’t do the ritght thing in that situation :wink:

Originally posted by jwatte:
[b]Cass,

I considered that, but chickened out because I’m sure there are drivers that wouldn’t do the ritght thing in that situation ;-)[/b]

Jon,

If they don’t, it’s a bug that they should fix.

You’re right of course that allowing a little slop (avoiding a singular matrix
in this case) is the safe bet, but we shouldn’t let the driver folks get away with too much.

Cass

Well, thanks guys, but none of both approaches work.

Jan.

How are your drawing the quad? What Z value are you using for it?

Originally posted by Jan2000:
[b]Well, thanks guys, but none of both approaches work.

Jan.[/b]

It should. What hw/drivers are you using?

My approach didn’t work, because I said GREATER when I meant LEQUAL.

glDepthRange(0.99999,1.0);
glDepthFunc(GL_LEQUAL);
MyDrawFullScreenQuadInMiddleOfNearFar();

Remember to set the depthrange back afterwards :slight_smile:

[This message has been edited by jwatte (edited 04-22-2003).]