Graphics Reference
In-Depth Information
Alternately, if you are developing your shaders through glman , you could use
the .glib file below, which uses specific values for the four patch vertices.
##OpenGL GLIB
Perspective 70
LookAt 0 0 3 0 0 0 0 1 0
Vertex beziercurve.vert
TessControl beziercurve.tcs
TessEvaluation beziercurve.tes
Fragment beziercurve.frag
Program BezierCurve uOuter1 <3. 5. 50.>
Color 1. 1. 0.
NumPatchVertices 4
glBegin gl_patches
glVertex 0. 0. 0.
glVertex 1. 1. 1.
glVertex 2. 1. 0.
glVertex 3. 0. 1.
glend
The vertex and fragment shaders would be the minimal shaders you have
seen in the chapters on these shaders, and the TCS shader beziercurve.tcs
could be
#version 400
#extension GL_ARB_tessellation_shader: enable
uniform float uOuter1;
layout( vertices = 4 ) out; // same size as input,
// (but doesn't have to be)
void main( )
{
gl_out[ gl_InvocationID ].gl_Position =
gl_in[ gl_InvocationID ].gl_Position;
gl_TessLevelOuter[0] = 1.;
gl_TessLevelOuter[1] = uOuter1;
}
A new detail in this code is the gl_InvocationId value. This value is the
output vertex number that corresponds to this instance of the TCS shader. In
Search WWH ::




Custom Search