home *** CD-ROM | disk | FTP | other *** search
/ Hackers Magazine 57 / CdHackersMagazineNr57.iso / Software / Multimedia / k3d-setup-0.7.11.0.exe / lib / site-packages / OpenGL / raw / GL / NV / fog_distance.py < prev    next >
Encoding:
Python Source  |  2008-12-07  |  2.5 KB  |  55 lines

  1. '''OpenGL extension NV.fog_distance
  2.  
  3. Overview (from the spec)
  4.     
  5.     Ideally, the fog distance (used to compute the fog factor as
  6.     described in Section 3.10) should be computed as the per-fragment
  7.     Euclidean distance to the fragment center from the eye.  In practice,
  8.     implementations "may choose to approximate the eye-coordinate
  9.     distance from the eye to each fragment center by abs(ze).  Further,
  10.     [the fog factor] f need not be computed at each fragment, but may
  11.     be computed at each vertex and interpolated as other data are."
  12.     
  13.     This extension provides the application specific control over how
  14.     OpenGL computes the distance used in computing the fog factor.
  15.     
  16.     The extension supports three fog distance modes: "eye plane absolute",
  17.     where the fog distance is the absolute planar distance from the eye
  18.     plane (i.e., OpenGL's standard implementation allowance as cited above);
  19.     "eye plane", where the fog distance is the signed planar distance
  20.     from the eye plane; and "eye radial", where the fog distance is
  21.     computed as a Euclidean distance.  In the case of the eye radial
  22.     fog distance mode, the distance may be computed per-vertex and then
  23.     interpolated per-fragment.
  24.     
  25.     The intent of this extension is to provide applications with better
  26.     control over the tradeoff between performance and fog quality.
  27.     The "eye planar" modes (signed or absolute) are straightforward
  28.     to implement with good performance, but scenes are consistently
  29.     under-fogged at the edges of the field of view.  The "eye radial"
  30.     mode can provide for more accurate fog at the edges of the field of
  31.     view, but this assumes that either the eye radial fog distance is
  32.     computed per-fragment, or if the fog distance is computed per-vertex
  33.     and then interpolated per-fragment, then the scene must be
  34.     sufficiently tessellated.
  35.  
  36. The official definition of this extension is available here:
  37.     http://oss.sgi.com/projects/ogl-sample/registry/NV/fog_distance.txt
  38.  
  39. Automatically generated by the get_gl_extensions script, do not edit!
  40. '''
  41. from OpenGL import platform, constants, constant, arrays
  42. from OpenGL import extensions
  43. from OpenGL.GL import glget
  44. import ctypes
  45. EXTENSION_NAME = 'GL_NV_fog_distance'
  46. GL_FOG_DISTANCE_MODE_NV = constant.Constant( 'GL_FOG_DISTANCE_MODE_NV', 0x855A )
  47. glget.addGLGetConstant( GL_FOG_DISTANCE_MODE_NV, (1,) )
  48. GL_EYE_RADIAL_NV = constant.Constant( 'GL_EYE_RADIAL_NV', 0x855B )
  49. GL_EYE_PLANE_ABSOLUTE_NV = constant.Constant( 'GL_EYE_PLANE_ABSOLUTE_NV', 0x855C )
  50.  
  51.  
  52. def glInitFogDistanceNV():
  53.     '''Return boolean indicating whether this extension is available'''
  54.     return extensions.hasGLExtension( EXTENSION_NAME )
  55.