3 GL_ARB_tessellation_shader
5 [vertex shader passthrough]
6 [tessellation evaluation shader]
7 #extension GL_ARB_tessellation_shader : require
13 gl_in[0].gl_Position * gl_TessCoord[0] +
14 gl_in[1].gl_Position * gl_TessCoord[1] +
15 gl_in[2].gl_Position * gl_TessCoord[2];
16 color = tan(vec4(gl_TessCoord[0], gl_TessCoord[1], gl_TessCoord[2], 1.0));
21 layout(triangle_strip, max_vertices = 3) out;
29 bary = vec3(1.0, 0.0, 0.0);
30 gl_Position = gl_in[0].gl_Position;
34 bary = vec3(0.0, 1.0, 0.0);
35 gl_Position = gl_in[1].gl_Position;
39 bary = vec3(0.0, 0.0, 1.0);
40 gl_Position = gl_in[2].gl_Position;
50 // antialias lines to make it a bit easier to see the gradient behind - note half
51 // of the line belongs to this triangle, half to the neighboring one,
52 // linewidth = 1 pixel
53 vec3 a = smoothstep(vec3(0.0), fwidth(bary), bary);
54 float halfedge = min(min(a.x, a.y), a.z);
55 gl_FragColor = mix(vec4(1.0), color2, halfedge);
69 patch parameter default level outer 1 1 1 1
70 patch parameter default level inner 4 4
72 clear color 0.5 0.5 0.5 1.0
74 patch parameter vertices 3
76 draw arrays GL_PATCHES 0 6
78 tolerance 0.15 0.15 0.15 0.0
80 # first patch check colors close to the corners are correct
81 relative probe rgba ( 0.064 , 0.016 ) ( 1.0 , 0.0 , 0.0 , 1.0 )
82 relative probe rgba ( 0.872 , 0.016 ) ( 0.0 , 1.0 , 0.0 , 1.0 )
83 relative probe rgba ( 0.016 , 0.872 ) ( 0.0 , 0.0 , 1.0 , 1.0 )
86 relative probe rgba ( 0.064 , 0.984 ) ( 1.0 , 0.0 , 0.0 , 1.0 )
87 relative probe rgba ( 0.98 , 0.12 ) ( 0.0 , 1.0 , 0.0 , 1.0 )
88 relative probe rgba ( 0.888 , 0.872 ) ( 0.0 , 0.0 , 1.0 , 1.0 )
90 # check that color close to center of first patch is correct
91 # since the vertex color computation is nonlinear we can tell if the patches
92 # have been tessellated or not
93 relative probe rgba ( 0.364, 0.336 ) ( 0.306, 0.388, 0.353, 1.0 )
96 relative probe rgba ( 0.624, 0.66 ) ( 0.306, 0.388, 0.353, 1.0 )