The modelling of the 3D objects was done using Blender. Once the vertex mesh was created, Blender was also used
to UV map textures to faces, providing texture coordinates and normal values. I
used the OBJ file format because it
was lightweight and easy to parse
. On exporting from Blender, I checked the triangulate faces option to ensure that
each face would definitely be defined as a triangle and so that GL_TRIANGLES could be used later. I wrot
e a simple
parser to take an OBJ file and produce a list of faces representing a model. The Face class represents a single 3
dimensional triangle with an associated texture. Using Blender provided an easy way to create models with textures
and normals incl
uded and because the models are separate from the program, models can easily be changed or
Each 3D model is rendered, using glNormal, gl
and then glVertex through the drawObject method which
takes a list of faces as a parameter.
Before each face is rendered, its associated texture as specified in the face object is bound to the GL context so that
the texture will be mapped to the next set of vertices drawn. The texture files are, in most, created by myself using
n software, although the space texture in the background is taken from a Google Image Search :
The program includes global ambient light, a two point lights. These are situated
at both the front and back of the
scene to provide adequate lighting on both sides of the car.
There are 3 moving parts in the system. The car itself can ‘drive’ around the track, which in turn causes the wheels to
rotate. The doors can also be op
ened, which swing on a ‘hinge’. The view of the scene can also be manipulated to
look at the model from different angles.
The shape of the track is calculated using geometry rather than a model from Blender. Varying alpha values are used
to create th
e transparent effect on the track a
nd the colours are allocated by cycling through an array.
drives the car forward
increase x axis rotation
reverses the car backward
decrease x axis rotation
rotates the scene clockwise
decrease z axis rotation
rotates the scene counter
increase z axis rotation
Renders a simple environment and places the car on a track. The user is able to drive the car
track, open the car doors and rotate the scene.
Renders the model without any environment
and places the model close to the camera
model can be rotated freely in this view.
screenshot of the track mode
screenshot of the view mode
Limitations & Improvements
Although the low vertex count means that the application generally runs smoothly, the
efficiency isn’t great. Using
vertex buffers, display lists or even triangle strips would improve the frame rate
. Using a lower level language such as
C or C++ also could have improved performance.
Some physics features such as acceleration and drift would
have been nice to give the car a more realistic feel. Better
yet, a game engine, to allow a better interactive experience would have been excellent.
I would have liked to have made the windows of the car transparent, but transparency was already used in g
of the road so it didn’t seem necessary. Because the windows are textured, the blend function would have to change
To run the program, you
need to import the Computer Graphics folder into a new Eclipse Project. The JOGL jar
files are located in lib folder and are on the build path of the project. The system dependant libraries are located in the
root of the folder and may have to be replaced
with the dlls which match your system.
Also ensure that the img and
obj folders are within reach of the classpath.
15 Transparency, Translucency, and Blending
(2006 , March 16). Retrieved February 2012, from OpenGl.org:
Angel, E. (2007).
OpenGL: A Primer
(3rd ed.). Addison
NeonHelium Productions. (n.d.).
Retrieved February 2012, from NeHe Productions:
Shreiner, D. (2009).
OpenGL Programming Guide
(7th ed.). Addison
Java binding for OpenGL