Processing Patch Input Vertices

Given the information from our patches, we can easily construct the tessellation control shader for our application, which is shown in Example 9.8.

Example 9.8. Tessellation Control Shader for Teapot Example

#version 420 corelayout (vertices = 16) out;void main(){    gl_TessLevelInner[0] = 4;    gl_TessLevelInner[1] = 4;    gl_TessLevelOuter[0] = 4;    gl_TessLevelOuter[1] = 4;    gl_TessLevelOuter[2] = 4;    gl_TessLevelOuter[3] = 4;    gl_out[gl_InvocationID].gl_Position                            = gl_in[gl_InvocationID].gl_Position;}

Using the tessellation level factors from Example 9.8, Figure 9.5 shows the patches of the teapot (shrunk slightly to expose each individual patch). ...

Get OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 4.3, Eighth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.