Apple Mac Starter Project

Intel Mac Starter Project

Windows Starter Project

Monkey OBJ File

Refining a mesh with PN Triangles

In this homework exercise we are going to implement the PN triangles algorithm to refine a mesh.

As a starting point for this exercise we are going to load a model from an OBJ file and apply a simple lighting model to it. The lighting model will use a directional light and a simple combination of directional and ambient lighting. Start by loading an appropriate version of the starting project for your operating system. The starting code I have provided is the code for the model loading tutorial from the Learn OpenGL web site.

Modify the program so that it loads the Monkey.obj file I have provided instead of the original backpack model. Update the shaders for this example to apply a simple lighting model with only directional lighting and ambient lighting. The resulting image should look something like this.

The PN Triangles algorithm

Next, read this tutorial from the ogldev.org web site that describes the PN triangles algorithm. To implement this algorithm you will need to modify your program to use a tessellation control shader and a tessellation evaluation shader in addition to a vertex shader and a fragment shader.

Since the PN Triangles algorithm uses patches, you will need to modify your mesh's drawing method to use GL_PATCHES instead of GL_TRIANGLES for drawing.