layout (vertices = 3) out;
void main(void)
{
if (gl_InvocationID == 0)
{
gl_TessLevelInner[0] = 5.0;
gl_TessLevelOuter[0] = 5.0;
gl_TessLevelOuter[1] = 5.0;
gl_TessLevelOuter[2] = 5.0;
}
gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
}
Excerpt From: Haemel, Nicholas. “OpenGL SuperBible":
How can I understand TessLevelInner
and TessLevelOuter
and why is the id 0 listed two times?
How can I understand
gl_TessLevelInner
andgl_TessLevelOuter
?
Please see:
gl_TessLevelInner
, gl_TessLevelOuter
, OpenGL Tessellation - Levels
As their names imply, they control the inner and outer tessellation factor levels for the primitive being processed. Below is an image illustrating the results of various inner/outer level settings.
Source: http://antongerdelan.net/opengl/tessellation.html
Why is the index
0
used twice?
It is used twice because it is accessing two different objects. The first use of index 0
is with
gl_TessLevelInner[0]
and the second is
gl_TessLevelOuter[0]