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 / EXT / point_parameters.py < prev    next >
Encoding:
Python Source  |  2008-12-07  |  3.7 KB  |  90 lines

  1. '''OpenGL extension EXT.point_parameters
  2.  
  3. Overview (from the spec)
  4.     
  5.         This extension supports additional geometric characteristics of points. It
  6.         can be used to render particles or tiny light sources, commonly referred
  7.         as "Light points".
  8.     
  9.         The raster brightness of a point is a function of the point area, point
  10.         color, point transparency, and the response of the display's electron gun
  11.         and phosphor. The point area and the point transparency are derived from the
  12.         point size, currently provided with the <size> parameter of glPointSize.
  13.     
  14.         The primary motivation is to allow the size of a point to be affected by
  15.         distance attenuation. When distance attenuation has an effect, the final
  16.         point size decreases as the distance of the point from the eye increases.
  17.     
  18.         The secondary motivation is a mean to control the mapping from the point
  19.         size to the raster point area and point transparency. This is done in order
  20.         to increase the dynamic range of the raster brightness of points. In other
  21.         words, the alpha component of a point may be decreased (and its transparency
  22.         increased) as its area shrinks below a defined threshold.
  23.     
  24.         This extension defines a derived point size to be closely related to point
  25.         brightness. The brightness of a point is given by:
  26.     
  27.                 1
  28.         dist_atten(d) = -------------------
  29.                 a + b * d + c * d^2
  30.     
  31.         brightness(Pe) = Brightness * dist_atten(|Pe|)
  32.     
  33.         where 'Pe' is the point in eye coordinates, and 'Brightness' is some initial
  34.         value proportional to the square of the size provided with glPointSize. Here
  35.         we simplify the raster brightness to be a function of the rasterized point
  36.         area and point transparency.
  37.     
  38.                 brightness(Pe)            brightness(Pe) >= Threshold_Area
  39.         area(Pe) =
  40.                 Threshold_Area            Otherwise
  41.     
  42.         factor(Pe) = brightness(Pe)/Threshold_Area
  43.     
  44.         alpha(Pe) = Alpha * factor(Pe)
  45.     
  46.         where 'Alpha' comes with the point color (possibly modified by lighting).
  47.     
  48.         'Threshold_Area' above is in area units. Thus, it is proportional to the
  49.         square of the threshold provided by the programmer through this extension.
  50.     
  51.         The new point size derivation method applies to all points, while the
  52.         threshold applies to multisample points only.
  53.  
  54. The official definition of this extension is available here:
  55.     http://oss.sgi.com/projects/ogl-sample/registry/EXT/point_parameters.txt
  56.  
  57. Automatically generated by the get_gl_extensions script, do not edit!
  58. '''
  59. from OpenGL import platform, constants, constant, arrays
  60. from OpenGL import extensions
  61. from OpenGL.GL import glget
  62. import ctypes
  63. EXTENSION_NAME = 'GL_EXT_point_parameters'
  64. GL_POINT_SIZE_MIN_EXT = constant.Constant( 'GL_POINT_SIZE_MIN_EXT', 0x8126 )
  65. GL_POINT_SIZE_MAX_EXT = constant.Constant( 'GL_POINT_SIZE_MAX_EXT', 0x8127 )
  66. GL_POINT_FADE_THRESHOLD_SIZE_EXT = constant.Constant( 'GL_POINT_FADE_THRESHOLD_SIZE_EXT', 0x8128 )
  67. GL_DISTANCE_ATTENUATION_EXT = constant.Constant( 'GL_DISTANCE_ATTENUATION_EXT', 0x8129 )
  68. glPointParameterfEXT = platform.createExtensionFunction( 
  69.     'glPointParameterfEXT', dll=platform.GL,
  70.     extension=EXTENSION_NAME,
  71.     resultType=None, 
  72.     argTypes=(constants.GLenum, constants.GLfloat,),
  73.     doc = 'glPointParameterfEXT( GLenum(pname), GLfloat(param) ) -> None',
  74.     argNames = ('pname', 'param',),
  75. )
  76.  
  77. glPointParameterfvEXT = platform.createExtensionFunction( 
  78.     'glPointParameterfvEXT', dll=platform.GL,
  79.     extension=EXTENSION_NAME,
  80.     resultType=None, 
  81.     argTypes=(constants.GLenum, arrays.GLfloatArray,),
  82.     doc = 'glPointParameterfvEXT( GLenum(pname), GLfloatArray(params) ) -> None',
  83.     argNames = ('pname', 'params',),
  84. )
  85.  
  86.  
  87. def glInitPointParametersEXT():
  88.     '''Return boolean indicating whether this extension is available'''
  89.     return extensions.hasGLExtension( EXTENSION_NAME )
  90.