$ man tshabbic.projects.ogl-steve
OGL-STEVE(8)OpenGL Steve RenderOGL-STEVE(8)
Name

ogl-steve -- OpenGL Steve Render

Description

[See the Source Code!] [Demo Video!]

This is a relatively simple program (as far as OpenGL is concerned) whose objective was simply to acclimate us with OpenGL fundamentals, such as: the matrix pipeline, 3D object rendering and coloring, etc. The actual assignment specifications were rather loose, but did strictly require knowledge of drawing 3D objects (mostly cubes), as well as knowing how to scale (stretch), translate (shift), and rotate the cubes, in addition to fixing z-fighting where problematic (specifically, Steve's eyes). Other features, such as limb sway and toggling between render modes, was explored at my own leisure, as this assignment and course serve as a reminder that not all programming has to serve a purpose, some things can be just for fun!

The most valuable lesson from this assignment was in no doubt performing scaling and translations via matrix manipulations. In order to get Steve's arms and legs to sway, we want to effectively draw his arms and legs as we normally would, but then apply a transformation (model) matrix to "angle" them from the point of origin, which for the legs is Steve's hips, and for the arms is his shoulders. To do this, OpenGL keeps a current matrix ("modelview" in this case), and all matrix operations (e.g., glTranslatef, glRotatef, etc.) apply to this current matrix. As such, we make a call to glPushMatrix to save whatever the modelview matrix is now, before drawing anything. Now we can make a call to glTranslatef to move the local origin of the coordinate system, in which all subsequent drawing will be expressed, to Steve's hips/shoulders. Immediately after, we call glRotatef with the desired swing angle about the X axis. Because the translation comes first, the rotation is applied about the hip/shoulder rather than about the world origin, which is what makes the limb pivot like a joint instead of orbiting around some arbitrary point. Each limb's cubes are then drawn relative to this new origin, with the rows hanging downward from the pivot and the depth centered on it, so the limb swings naturally about its joint. Once the limb is drawn, we call glPopMatrix to restore the modelview matrix we saved earlier. This ensures the translation and rotation applied to one limb don't leak into the next limb or the torso. As for the illusion of motion itself, it's a simple as passing an angle parameter that changes slightly between frames to the functions responsible for drawing Steve's limbs, and voilĂ  he's moving!

Usage

This program does not take any command-line arguments.
It does however respond to interactive key presses:

Up/Down

Rotate the scene around the X-axis

Left/Right

Rotate the scene around the Y-axis

[ / ]

Adjust the field of view (perspective)

P

Toggle between orthographic and perspective projections

R

Toggle Steve render between hand-drawn geometry and raw pixel data

W/S

Adjust the rate at which Steve's limbs sway (effects only visible in hand-drawn rendering mode)

Q / Esc

Exit the program gracefully

This program can be compiled and ran on Linux by executing make(1) in a directory with all of the source files (assuming all dependencies are installed, e.g., -lglfw, -lGL) and running ./steve. Compatibility with other operating systems has not been tested.

Bugs

Raw rendering mode has no effective concept of "depth", it simply extrudes the RGB values it is given to the specified length, which in turn results in Steve quite literally having eyes in the back of his head. This has been accounted for and does not happen in the "hand drawn" implementation.

See Also
History

This was the first, introductory assignment for CS 537 - Interactive Computer Graphics @ Stevens Institute of Technology and was completed during the Fall 2026 semester.

As of writing, this is the first offering of CS 537 - Interactive Computer Graphics since Spring 2022 and as such the course's curriculum has been overhauled since.