Getting ready

Set up your shaders with a vertex shader that simply passes the vertex position along without any modification (you can use the same vertex shader as was used in the Tessellating a 2D quad recipe). Create a fragment shader that implements whatever shading model you choose. The fragment shader should receive the TENormal and TEPosition input variables, which will be the normal and position in camera coordinates.

The TessLevel uniform variable should be given the value of the desired tessellation level. All of the inner and outer levels will be set to this value.

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.