Basic 3D Object Renderer using OpenGL Graphics Libraries and Qt


As part of a final project in my computer graphics class, I was required to develop a graphical user interface with Qt libraries that acted as a wrapper around an OpenGL powered 3D model renderer. This program utilized standard user interface techniques such as pop out menus, radio buttons, spin boxes , mouse tracking , and active message passing to enact updates. Qt is fantastic library with its own standalone IDE and editor to create programs with supporting GUI’s.

OpenGL is one of the most powerful graphics libraries available for free to users. This API interfaces with graphics hardware to render 3D vector graphics. OpenGL involves lots of transformations and manipulations of matrices, which definitely challenged my knowledge of linear algebra πŸ™‚ Here is a description and summary of the elements in my program:

Description of the 3D Model Viewer and Renderer
This program provides an intuitive graphical user interface to access a few of
OpenGL’s many rendering options and techniques, without having to code.
With the ability to load in β€œ.3ds” files; users can test a variety of material
and lighting options to view the output without physically altering the
original data. Users have access to up to three lights and their properties,
material properties, environmental mapping, and a variety of shaders. The
integrated mouse controls also allow users to rotate, pan , and zoom the
perspective to view all aspects of the rendered model.


Basic User’s guide
1. Opening a File and Predefined Models
Users can load any basic β€œ.3ds file into the program using file->open
option. This command will import the vertices and faces of the model,
render them in the scene, and scale the model to be appropriately viewed.
The user can also choose from two more included models: Icosahedron and
Teapot found in the File menu.
2. Shaders Menu
Under the shaders menu user can choose from several shaders that can be
applied to the rendered model:
● Flat Shader
● Smooth Shader
● Phong Shader
● Per Pixel Shader
● Normal Mapping (currently not functional)
● Toon Shader
● Custom Shader 1 (Mouse controlled shading)
● Custom Shader 2 (random coloring)
3. Lights Menu
Under the Lights menu the user can choose to edit one of three different
lights in the scene. Selecting a light shows a properties window where the
following light attributes can be modified:
● Light enabled
● Spot Light/Point Light
● Position
● Direction (Spot Light)
● Spot Light Cutoff Angle
● Coefficients for Light Attenuation
● RGB Ambient Values
● RGB Diffuse Values
● RGB Specular Values
4. Material Menu
Within the material menu, user can modify the material attributes applied
to the rendered model. The properties window allows the following values
to be altered:
● Set default material
● RGB Ambient Values
● RGB Diffuse Values
● RGB Specular Values
● RGB Emissive Values
● Shininess
5. Environment Map Menu
Within the environment map menu users can enable or disable environment
mapping on the rendered object. Users can also specify the path for desired
images to be mapped onto the object. Currently only β€œ.tga” files are
6. User Camera Control
● Rotate Camera (hold down left mouse button while moving mouse)
● Pan Camera (hold down right mouse button while moving mouse)
● Zoom in (move mouse wheel forward)
● Zoom out (move mouse wheel backward)

program1 program2

Here is Github repository with all the source code:

Warning: One of my custom fragment shaders uses a random number generator to determine pixel color values. Epileptics should probably avoid this feature…