1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
'''OpenGL extension NV.depth_clamp
Overview (from the spec)
Conventional OpenGL clips geometric primitives to a clip volume
with six faces, two of which are the near and far clip planes.
Clipping to the near and far planes of the clip volume ensures that
interpolated depth values (after the depth range transform) must be
in the [0,1] range.
In some rendering applications such as shadow volumes, it is useful
to allow line and polygon primitives to be rasterized without
clipping the primitive to the near or far clip volume planes (side
clip volume planes clip normally). Without the near and far clip
planes, rasterization (pixel coverage determination) in X and Y
can proceed normally if we ignore the near and far clip planes.
The one major issue is that fragments of a primitive may extend
beyond the conventional window space depth range for depth values
(typically the range [0,1]). Rather than discarding fragments that
defy the window space depth range (effectively what near and far
plane clipping accomplish), the depth values can be clamped to the
current depth range.
This extension provides exactly such functionality. This
functionality is useful to obviate the need for near plane capping
of stenciled shadow volumes. The functionality may also be useful
for rendering geometry "beyond" the far plane if an alternative
algorithm (rather than depth testing) for hidden surface removal is
applied to such geometry (specifically, the painter's algorithm).
Similar situations at the near clip plane can be avoided at the
near clip plane where apparently solid objects can be "seen through"
if they intersect the near clip plane.
The official definition of this extension is available here:
http://oss.sgi.com/projects/ogl-sample/registry/NV/depth_clamp.txt
Automatically generated by the get_gl_extensions script, do not edit!
'''
from OpenGL import platform, constants, constant, arrays
from OpenGL import extensions
from OpenGL.GL import glget
import ctypes
EXTENSION_NAME = 'GL_NV_depth_clamp'
GL_DEPTH_CLAMP_NV = constant.Constant( 'GL_DEPTH_CLAMP_NV', 0x864F )
glget.addGLGetConstant( GL_DEPTH_CLAMP_NV, (1,) )
def glInitDepthClampNV():
'''Return boolean indicating whether this extension is available'''
return extensions.hasGLExtension( EXTENSION_NAME )
|