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 Outer and why is the id 0 listed two times?
For triangles, each of the first three "outer" gl_TessLevelOuter[] tessellation values control the subdivision of one of the three sides of the triangle, and the fourth value is unused.
Only the first "inner" gl_TessLevelInner[0] value is used, to determine the subdivision of the the inner triangle. This inner level is more confusing than the outer level, so looking at a picture is better than trying to explain it.
Here is a similar image to the accepted answer, but with the inner value row labels corrected, and a program you can use to experiment with your own values.
The image source link on the accepted answer is currently broken (May 2019). Plus the row labeled "Inner Tesselation Factor" is off by one. The inner tessellation value of the first row is actually zero.
Python program for creating the above image:
Please see:
gl_TessLevelInner
,gl_TessLevelOuter
, OpenGL Tessellation - LevelsAs 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
It is used twice because it is accessing two different objects. The first use of index
0
is withand the second is