PDA

View Full Version : depthfunc



Jan
04-21-2003, 03:01 AM
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.

Ysaneya
04-21-2003, 04:01 AM
I'd simply draw a full-screen quad, with Z-test enabled, and a Z value as far as possible.

Y.

jwatte
04-21-2003, 10:22 AM
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.

Humus
04-21-2003, 01:25 PM
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.

cass
04-21-2003, 03:15 PM
Originally posted by jwatte:
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.

Or a DepthFunc(EQUAL) and a DepthRange(1,1). http://www.opengl.org/discussion_boards/ubb/smile.gif

jwatte
04-21-2003, 06:40 PM
Cass,

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

cass
04-21-2003, 06:53 PM
Originally posted by jwatte:
Cass,

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

Jon,

http://www.opengl.org/discussion_boards/ubb/wink.gif 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. http://www.opengl.org/discussion_boards/ubb/smile.gif

Cass

Jan
04-22-2003, 12:03 AM
Well, thanks guys, but none of both approaches work.

Jan.

Nutty
04-22-2003, 03:38 AM
How are your drawing the quad? What Z value are you using for it?

cass
04-22-2003, 06:06 AM
Originally posted by Jan2000:
Well, thanks guys, but none of both approaches work.

Jan.

It should. What hw/drivers are you using?

jwatte
04-22-2003, 09:50 AM
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 :-)

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