1'''OpenGL extension ARB.point_parameters 2 3This module customises the behaviour of the 4OpenGL.raw.GL.ARB.point_parameters to provide a more 5Python-friendly API 6 7Overview (from the spec) 8 9 This extension supports additional geometric characteristics of 10 points. It can be used to render particles or tiny light sources, 11 commonly referred to as "Light points". 12 13 The raster brightness of a point is a function of the point area, 14 point color, point transparency, and the response of the display's 15 electron gun and phosphor. The point area and the point transparency 16 are derived from the point size, currently provided with the <size> 17 parameter of glPointSize. 18 19 The primary motivation is to allow the size of a point to be 20 affected by distance attenuation. When distance attenuation has an 21 effect, the final point size decreases as the distance of the point 22 from the eye increases. 23 24 The secondary motivation is a mean to control the mapping from the 25 point size to the raster point area and point transparency. This is 26 done in order to increase the dynamic range of the raster brightness 27 of points. In other words, the alpha component of a point may be 28 decreased (and its transparency increased) as its area shrinks below 29 a defined threshold. 30 31 This extension defines a derived point size to be closely related to 32 point brightness. The brightness of a point is given by: 33 34 1 35 dist_atten(d) = ------------------- 36 a + b * d + c * d^2 37 38 brightness(Pe) = Brightness * dist_atten(|Pe|) 39 40 where 'Pe' is the point in eye coordinates, and 'Brightness' is some 41 initial value proportional to the square of the size provided with 42 PointSize. Here we simplify the raster brightness to be a function 43 of the rasterized point area and point transparency. 44 45 brightness(Pe) brightness(Pe) >= Threshold_Area 46 area(Pe) = 47 Threshold_Area Otherwise 48 49 factor(Pe) = brightness(Pe)/Threshold_Area 50 51 alpha(Pe) = Alpha * factor(Pe) 52 53 where 'Alpha' comes with the point color (possibly modified by 54 lighting). 55 56 'Threshold_Area' above is in area units. Thus, it is proportional to 57 the square of the threshold provided by the programmer through this 58 extension. 59 60 The new point size derivation method applies to all points, while 61 the threshold applies to multisample points only. 62 63The official definition of this extension is available here: 64http://www.opengl.org/registry/specs/ARB/point_parameters.txt 65''' 66from OpenGL import platform, constant, arrays 67from OpenGL import extensions, wrapper 68import ctypes 69from OpenGL.raw.GL import _types, _glgets 70from OpenGL.raw.GL.ARB.point_parameters import * 71from OpenGL.raw.GL.ARB.point_parameters import _EXTENSION_NAME 72 73def glInitPointParametersARB(): 74 '''Return boolean indicating whether this extension is available''' 75 from OpenGL import extensions 76 return extensions.hasGLExtension( _EXTENSION_NAME ) 77 78# INPUT glPointParameterfvARB.params size not checked against 'pname' 79glPointParameterfvARB=wrapper.wrapper(glPointParameterfvARB).setInputArraySize( 80 'params', None 81) 82### END AUTOGENERATED SECTION 83 84