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 51 52 53 54 55 56 57
|
'''OpenGL extension ARB.derivative_control
This module customises the behaviour of the
OpenGL.raw.GL.ARB.derivative_control to provide a more
Python-friendly API
Overview (from the spec)
This extension provides control over the spacial granularity at which the
underlying implementation computes derivatives.
For example, for the coarse-granularity derivative, a single x derivative
could be computed for each 2x2 group of pixels, using that same derivative
value for all 4 pixels. For the fine-granularity derivative, two
derivatives could be computed for each 2x2 group of pixels; one for the top
row and one for the bottom row. Implementations vary somewhat on how this
is done.
To select the coarse derivative, use:
dFdxCoarse(p)
dFdyCoarse(p)
fwidthCoarse(p)
To select the fine derivative, use:
dFdxFine(p)
dFdyFine(p)
fwidthFine(p)
To select which ever is "better" (based on performance, API hints, or other
factors), use:
dFdx(p)
dFdy(p)
fwidth(p)
This last set is the set of previously existing built-ins for derivatives,
and continues to work in a backward compatible way.
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/ARB/derivative_control.txt
'''
from OpenGL import platform, constant, arrays
from OpenGL import extensions, wrapper
import ctypes
from OpenGL.raw.GL import _types, _glgets
from OpenGL.raw.GL.ARB.derivative_control import *
from OpenGL.raw.GL.ARB.derivative_control import _EXTENSION_NAME
def glInitDerivativeControlARB():
'''Return boolean indicating whether this extension is available'''
from OpenGL import extensions
return extensions.hasGLExtension( _EXTENSION_NAME )
### END AUTOGENERATED SECTION
|