Getting ready

This program is nearly identical to the one in the Tessellating a 3D surface recipe. The only difference lies within the TCS. We'll remove the TessLevel uniform variable, and add a few new ones that are described as follows:

  • MinTessLevel: This is the lowest desired tessellation level
  • MaxTessLevel: This is the highest desired tessellation level
  • MinDepth: This is the minimum distance from the camera, where the tessellation level is maximal
  • MaxDepth: This is the maximum distance from the camera, where the tessellation level is at a minimum

Render your objects as 16-vertex patch primitives as indicated in the Tessellating a 3D surface recipe.

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.