Graphics Reference
In-Depth Information
formed patch vertices from the vertex shaders. It gets to see the entire set of
patch data. It transforms the input coordinates to a regular surface representa-
tion, and computes the required tessellation level based on distance to the eye,
screen space spanning, hull curvature, displacement roughness, or whatever
criteria make most sense for your application.
The TCS takes as input an array gl_in[ ] of structures, one structure per
control vertex, that contain
vec4 gl_Position;
float gl_PointSize;
float gl_ClipDistance[ ];
as well as these single variables:
int gl_InvocationID , which tells you which output vertex you are work-
ing on. This must be the value used to index a write into the gl_out[ ]
array. You can read all other gl_out array values, but you can only write
your own.
int gl_PatchVerticesIn is the number of vertices in each patch and the
dimension of gl_in[ ]
int gl_PrimitiveID is the number of primitives since the last glBegin( )
(the first one is #0)
The TCS must let the pipeline know how many final control points will be
output. 2 This is done with the layout qualifier as follows:
layout( vertices = N ) out;
The output from the TCS includes gl_out[ ] , an array of structures that
is the same size as the N that is specified by the layout qualifier. Each structure
contains
vec4 gl_Position;
float gl_PointSize;
float gl_ClipDistance[ ];
as well as the additional output variables
patch out float gl_TessLevelOuter[4] , an array containing up to four
levels of tessellation at the outer edges, and
2. The number of output control points has to do with the geometric equations you are using for this
patch. It has nothing to do with how many output primitives will eventually be produced. That
speciication is called seting the “tessellation levels,” and is coming up in a moment.
Search WWH ::




Custom Search