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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
'''OpenGL extension AMD.vertex_shader_tessellator
This module customises the behaviour of the
OpenGL.raw.GL.AMD.vertex_shader_tessellator to provide a more
Python-friendly API
Overview (from the spec)
The vertex shader tessellator gives new flexibility to the shader
author to shade at a tessellated vertex, rather than just at a
provided vertex.
In unextended vertex shading, the built-in attributes such as
gl_Vertex, gl_Normal, and gl_MultiTexcoord0, together with the
user defined attributes, are system provided values which are
initialized prior to vertex shader invocation.
With vertex shading tessellation, additional vertex shader special
values are available:
ivec3 gl_VertexTriangleIndex; // indices of the three control
// points for the vertex
vec3 gl_BarycentricCoord; // barycentric coordinates
// of the vertex
i o
|\
| \
*--*
|\ |\
| \| \
*--*--*
|\ |\ |\
| \| \| \
j o--*--*--o k
Figure 1 A Tessellated Triangle
o = control point (and tessellated vertex)
* = tessellated vertex
ivec4 gl_VertexQuadIndex; // indices for the four control
// points for the vertex
vec2 gl_UVCoord; // UV coordinates of the vertex
i o--*--*--o k
|\ |\ |\ |
| \| \| \|
*--*--*--*
|\ |\ |\ |
| \| \| \|
*--*--*--*
|\ |\ |\ |
| \| \| \|
j o--*--*--o l
Figure 2 A Tessellated Quad
o = control point (and tessellated vertex)
* = tessellated vertex
When this extension is enabled, conventional built-in attributes
and user defined attributes are uninitialized. The shader writer
is responsible for explicitly fetching all other vertex data either
from textures, uniform buffers, or vertex buffers.
The shader writer is further responsible for interpolating
the vertex data at the given barycentric coordinates or uv
coordinates of the vertex.
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/AMD/vertex_shader_tessellator.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.AMD.vertex_shader_tessellator import *
from OpenGL.raw.GL.AMD.vertex_shader_tessellator import _EXTENSION_NAME
def glInitVertexShaderTessellatorAMD():
'''Return boolean indicating whether this extension is available'''
from OpenGL import extensions
return extensions.hasGLExtension( _EXTENSION_NAME )
### END AUTOGENERATED SECTION
|