PDA

View Full Version : Drawing outside depth buffer



surfdabbler
11-09-2005, 02:56 PM
I have a model that includes many polygons in a small defined area, but also includes a few lines that run a long way outside the area. I don't want to compromise the accuracy of the depth buffer by extending the near and far planes, because all my polygons are in a confined space, but when spinning the object around, and particularly when zooming in close, I don't want the lines to be clipped.

As they are lines, I was wondering if there was any way to turn off the depth clipping, such that pixels are still compared against the depth buffer for clipping, but anything behind the far plane is drawn as if it was on the far plane, and anything in front of the near plane was drawn as if it were on the near plane. Is this possible?

My program implements ortho and perspective views, so even if it's only possible in one of these, that would be OK.

ScottManDeath
11-09-2005, 03:08 PM
There is the GL_NV_depth_clamp extension for nvidia cards, which just does that. :)

surfdabbler
11-09-2005, 03:22 PM
Perfect. Pity it's NVidea only though, but I will implement it anyway. So how do you use this... glEnable(GL_NV_depth_clamp)?

The only value I can find on the net for GL_NV_depth_clamp is 1. What should it really be?

Eric Lengyel
11-09-2005, 10:53 PM
You need this:

#define GL_DEPTH_CLAMP_NV 0x864F

Then you can call glEnable/glDisable (GL_DEPTH_CLAMP_NV).

jide
11-09-2005, 10:54 PM
What if you read the specs of this extension ?
http://oss.sgi.com/projects/ogl-sample/registry/NV/depth_clamp.txt