How it works...

The vertex shader passes the position along to the TCS unchanged.

The TCS defines the number of vertices in the patch using the layout directive:

layout (vertices=4) out; 

In the main function, it passes along the position of the vertex without modification, and sets the inner and outer tessellation levels. All four of the outer tessellation levels are set to the value of Outer, and both of the inner tessellation levels are set to Inner.

In the tessellation evaluation shader, we define the tessellation mode and other tessellation parameters with the input layout directive:

layout ( quads, equal_spacing, ccw ) in; 

The quads parameter indicates that the tessellation-primitive generator should tessellate the parameter space ...

Get OpenGL 4 Shading Language Cookbook - Third 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.