batman.png

This was a project for a university assignment in which we were tasked with creating a model viewer using C++ and OpenGL which could do the following

  • Support loading 3D .obj models.

  • Support .obj material file handling.

  • Use an event system to handle window resizing events.

  • A skybox.

  • A camera to view the scene with that can be moved around.

 
optimisedTestOBJVIEWER2.gif

When no .mtl (material) file is supplied to the renderer, a default material is supplied.

This is a set of default values that tells the shader program what the model should look like, how it should be lit up, and what colour it should be.

To add more interactivity to the model viewer, I added a feature that allows the user to modify that default material value to whatever they choose, as seen on the left.

 

When the material file is loaded sometimes it may specify that textures are to be used on the model.

When this is the case the program adds to the material that is being read from that a texture should be used whenever a mesh using that material is rendered.

The texture data is then passed to the shader which then applies that colour to the current mesh being rendered.

texturedMan2_edited_edited_edited.jpg