projects‎ > ‎School‎ > ‎


In the winter semester of 2009 I chose to take a course in Computer Graphics. I've had a great interest in computer graphics ever since the early 90's, and have followed the works of those who I consider to be pioneers (John Carmack, Tim Sweeney) of mainstream real-time computer graphics. I had the great privilege of taking the course from Professor Robert Burton, who received his Ph.D. under Ivan Sutherland commonly known as the "father of computer graphics".

The text used in the course was "Computer Graphics with OpenGL, 3e" by Hearn/Baker.

Implementing opengl methods

Throughout the majority of my computer graphics course we implemented our own versions of many common OpenGL methods. Drawing things at this level is extremely rudimentary, to me it felt comparable to writing programs in assembly.

Basic Rasterizing
glClearColor(r,g,b,a), glClear(GLint), glBegin(GLenum) with parameters GL_POINTS, GL_LINES, GL_TRIANGLES, GL_LINE_STRIP, GL_LINE_LOOP, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN
GL_QUADS, GL_QUAD_STRIP, GL_POLYGON, glVertex2i(int, int), glEnd(), glColor3f(r,g,b)

(Even simple images such as these can be quite complicated to generate if all you have is a text editor and a 640x480 canvas. Thank goodness many smart people have already made OpenGL)


glViewport( xmin, ymin, width, height ), glLoadIdentity(), glLoadMatrixd(), glMultMatrixd(), glPushMatrix(), glMultMatrixd(), glPopMatrix(), glRotatef(), glTranslatef(), glScalef(), glOrtho(), glPolygonOffset()

glNormal3f(), glFrustum(), gluPerspective(), glNormal3f(), glLightfv(), glMaterialf(), glMaterialfv(), glShadeModel(), glFrontFace(), glCullFace()

It was very rewarding to go from simple triangles and squares to 3-d shapes that could rotate and receive lighting! While most of the course focused on these low level fundamentals of graphics, we were able to explore different areas near the end of the class. One of those follows below.

Implementing a ray tracer

Near the end of our course we had the chance to work on a ray tracer. Basically, we threw away all of our previous code and started from scratch. In my implementation I only worked with spheres. The following formulas were used to calculate the rays: (click image for a more lengthy illustration of formulas. credit to Dr. Burton for the formulas)
Ray Tracing is an amazing thing! It is very good at calculating shadows and reflections. However, because of the computational complexity that can be involved I'm not sure how soon we'll have mainstream real-time ray-tracing applications running on our desktops. Rasterizing is so much faster! Nevertheless, many companies are researching the possibilities, such as Intel. If all of your rendering is done beforehand (let's say for example you are Pixar and you make multi-million dollar movies) then ray tracing is more easily adopted. You may have heard of the CG motion picture "Cars". It was the first film to use ray tracing, this pdf is a great explanation of that.

Using opengl, and life beyond class
Current topics of the day that interest me are virtual textures (aka Mega Textures) and also dynamic terrain generation / fractal landscapes.