Graphics Reference
In-Depth Information
The interpolation patern generated by the TPG is deined by a layout
qualifier in the TES. 3 When used for defining the TES production, it has the
form
triangles
quads
isolines
equal_spacing
ccw
cw
layout(
,
fract
ional_even_spacing
fractional_odd_spacing
,
,point_mode) in;
The irst parameter speciies the tessellation patern: should the tessellation
primitive generator subdivide a triangle into smaller triangles, a quad into
triangles, or a quad into a collection of line segments, respectively? The second
parameter specifies the spacing of the segments, the third the orientation of
the triangles (if any) that are produced; specifying point_mode tells the TES is
to produce a point at each output vertex rather than triangles or lines. Equal
spacing and counterclockwise orientation are the defaults.
A typical invocation of this layout line might be
layout( triangles, equal_spacing, ccw ) in;
The TES has access to an input variable gl_in[ ] , which is identical to the
gl_out[ ] from the TCS, as well as the single variables
in int gl_PatchVerticesIn;
in int gl_PrimitiveID;
in vec3 gl_TessCoord;
It writes the information for the one vertex it is computing to the three output
variables
vec4 gl_Position;
float gl_PointSize;
float gl_ClipDistance[ ];
The write to gl_Position is required. The write to the other two is optional.
In addition to the built-in variables mentioned, both the TCS and the TES
can take user-defined variables. User-defined variables that are defined per-
vertex are qualified as out or in , while user-defined variables defined per-
patch are qualified as patch out or patch in .
3. This seems confusing, having the TES essentially “pass information upstream” to the TPG. Don't let
it worry you. The shader compile and linking process takes care of this.
Search WWH ::




Custom Search