Assignment -
The goals of this assignment are to familiarize yourself with obj parser, the OpenGL command of the illumination, shading and texture mapping.
Part A: Obj Parser
Obj Parser will load a wavefront obj mesh file, compute the normal for each face and display it.
The obj mesh file format is described here. More obj mesh files may be found on the internet
- Download objLoader.zip, cube.obj, teapot.obj and pig.obj
- Compile, run and understand the code
Part B: Illumination and Shading
Based on the previous assignment, extend the system to support the following features:
- Support for a light source.
- Interactively turn light(s) on and off.
- Support flat, Gouraud or Phong shading models. (Hint: In order to do Smooth/Gouraud shading, you need to provide the normal vector for each vertex using glNormal. The vertex normal can be computed as the average of all the faces/triangles adjacent to the current vertex as described in here).
- interactive change the (RGB) values associated with the global ambient light.
- interactive change the (RGB) values associated with the ambient, diffuse and specular component of the light sources.
- interactive change the (RGB) values associated with the ambient, diffuse and specular material properties of the objects.
Part C: Texture Mapping
- Download header file stb_image.h that read images to OpenGL textures
- Read cube.obj and an image file (.jpg) as a texture (here are two sample images: checker-board, mandrill, you can also use any other images you like) , and render the object with the texture mapped.
Attachment:- Assignment Files.rar