3 GL_ARB_tessellation_shader
5 [vertex shader passthrough]
7 [tessellation control shader]
8 #extension GL_ARB_tessellation_shader: require
9 layout(vertices = 6) out;
12 patch out vec4 pcolor;
15 gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
16 if (gl_InvocationID < val.length())
17 val[gl_InvocationID] = gl_InvocationID;
19 pcolor = vec4(0, 1, 0, 1);
23 for (int i = 0; i < val.length(); i++) {
24 // Switch things up so that each invocation checks
25 // different locations
26 int index = (i + gl_InvocationID) % val.length();
27 if (val[index] != index)
28 pcolor = vec4(1, 0, 0, 1);
31 gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 0.0);
32 gl_TessLevelInner = float[2](0.0, 0.0);
36 [tessellation evaluation shader]
37 #extension GL_ARB_tessellation_shader: require
44 gl_Position = gl_in[0].gl_Position * gl_TessCoord[0]
45 + gl_in[1].gl_Position * gl_TessCoord[1]
46 + gl_in[2].gl_Position * gl_TessCoord[2];
74 clear color 0.0 0.0 0.0 1.0
77 patch parameter vertices 3
78 draw arrays GL_PATCHES 0 6
79 probe all rgba 0.0 1.0 0.0 1.0
81 clear color 0.0 0.0 0.0 1.0
84 patch parameter vertices 6
85 draw arrays GL_PATCHES 0 12
86 probe all rgba 0.0 1.0 0.0 1.0