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

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