EE 7722 - Code Examples

Code used in class. The links below may point to out-of-date copies, use anonymous svn to retrieve the latest copies. Code is also available via anonymous svn from Those not familiar with SVN should read these SVN instructions.

CPU-Only Code Examples

Code in which 3D graphics computed entirely on the CPU. The intent here is to understand 3D algorithms and their computational characteristics. Code Repository

Single Triangle (2009)

Demonstrates the most basic 3D techniques: how to project a triangle specified in object space onto a frame buffer. Draws one lonely (presumably) triangle.


Many Triangles (2009)

Demonstrates how to apply 3D techniques to a list of possibly unrelated primitives (triangles). The routine draws a grid of identical triangles pierced by a unique one.


Color & Z Buffering (2009)

Demonstrates color interpolation and Z buffering. The routine draws a grid of triangles pierced by a triangle. The angle of the grid can be interactively adjusted.


Lighting (2009)

Demonstrates simple lighting techniques. The routine draws a gold tube pierced by a triangle. There is a bright light in the tube that can dimmed, brightened, and moved around.


Textures (2009)

Demonstrates simple texture application and perspective-correct interpolation. Draws the tube, this time it surrounds two rectangles, one composed of many triangles, the other composed of two big ones. Textures can be applied to the tube and rectangles.

OpenGL Examples

Code using OpenGL for rendering. Code Repository

Textures (2009)

Texturing Examples. The code shows an undulating tube pierced by a purple quadrilateral. After turning on texturing the course syllabus will appear on the quadrilateral and tube. Filtering and texture mode can be changed using the UI.


Fragment Shader / Phong Shading (2009)

Simple fragment shader example. A fragment shader is used to implement Phong shading. Also see the shader code.

GPU Physics

Code using OpenGL and CUDA for physics and OpenGL for rendering. Code Repository

Bouncing Ball Simulation Using CUDA (Spring 2010)

Simulation of balls bouncing on a half-cylinder platform, scene also includes a water wheel and a staircase. The ball physics is performed by GPU via CUDA (or just by CPU) and vertex and geometry shaders are used to compute ball reflection locations. Other techniques include shadow volume to stencil shadow locations and occlusion queries to limit the number of balls rendered. See also CUDA code, and Shader code.

Balloon Simulation Using GLSL and CUDA (2009)

Simulation of a balloon, with physics performed by GPU using either OpenGL Shader Language (GLSL) or CUDA. Also see the OpenGL shader code used for physics, the CUDA code used for physics, the PTX pseudo GPU assembly language of the CUDA code, and the true (maybe) GPU assembly language of the CUDA code.

David M. Koppelman -
Modified 29 Nov 2010 14:15 (2015 UTC)