The following repository contains the implementation of a basic mesh/object viewer for .obj
files. The project has been implemented in C++ using OpenGL and GLSL. This project was largely pursued to be able to get familiar with OpenGL and GLSL. The project uses the typical OpenGL rendering pipeline and uses the phong lighting model for lighting calculations.
A sample binary has been uploaded with the repo (compiled on x86, as a 64 bit application), but its unlikely that it would generally work even on a system with the same configuration (try anyway, it just might).
To compile, create a directory called build
and create Makefile using the cmake build system
mkdir build && cd build
cmake ..
make
Once the project is compiled, the binary is directed to a bin
directory, and takes the .obj
mesh as a command line argument
./bin/viewer objects/bunny.obj
The text newlines and messages have been hardcoded for full HD (1920x1080) resolution, but lower resolutions should not really be a problem.
One of Smooth, Lines, Point Cloud, Mesh
Sliders for Ambient, Diffuse, Specular, Shininess (in accordance to Phong Lighting model), and a checkbox for activating RBG inputs for the above sliders
Keyboard or Mouse, for Translation and Rotation (Alternate)
Same thing as using mouse to move object around, but finer control
RGB and XYZ Sliders for 5 light sources, 4 of which are off by default
The project uses glm for maths, ImGui for the GUI and GLFW as the windowing library. GLEW was used to access OpenGL. The folder objects
has a fair few objects to be able to play around with. Most of these were downloaded from here and were corrected using Meshlab.