OpenGL® Examples



More Samples


View Image Description View Source
bounce.jpg Program that lets you play around with light attenuation using neat OpenGL-based sliders. bounce.zip
chess.jpg Classic chessboard with (relatively) complicated pieces (pieces by Randy Brown). Drag the middle mouse button to spin board. chess.zip
csg.jpg Constructive Solid Geometry program based on information from the Advanced OpenGL Rendering course at SIGGRAPH '96 by David Blythe and Tom McReynolds. Click right mouse button for menu. csg.zip
cube.jpg Very simple Win32 example of drawing a cube. cube.zip
distort.jpg Awesome program that causes ripples in the image wherever the mouse button is pressed. Another mode of the program acts like a sheet of rubber and can be pulled by dragging the mouse. distort.zip
drip.jpg Neat little program that makes a drip wherever the mouse button is pressed. drip.zip
gliq.jpg An OpenGL version of the pegboard game IQ. gliq.zip
lorenz.jpg This program shows some particles stuck in a Lorenz attractor (the parameters used are r=28, b=8/3, sigma=10). The eye is attracted to the red particle, with a force directly proportionate to distance. A command line puts the whole mess inside a box made of hexagons. I think this helps to maintain the illusion of 3 dimensions, but it can slow things down. Other options allow you to play with the redraw rate and the number of new lines per redraw. So you can customize it to the speed of your machine. lorenz.zip
maze.jpg In this little demo the player navigates through a simple maze using the arrow keys. The maze is defined by a 2D array where each element in the array indicates solid or empty space. This program wraps polygon (quad) walls around the solid space and disallows the player to navigate into solid space during the demo. Note that all the walls are limited to being 90 degrees to each other - there are no "angled" features. The purpose of this sample program is to show a beginning 3D game programmer some things they can do.

One other cool thing that this program does is that it constucts a single quad strip to draw all the walls by doing a recursive depth first search on the maze array data.
maze.zip
meshview.jpg Simple program to visualize a mesh with a color ramp scale. Press 'h' for a help menu. Specify a data file as a command line argument. meshview.zip
rainbow.jpg Demonstration of palette animation in color index mode. Press 'h' for a help menu, middle button spins. rainbow.zip
sgiflag.jpg This program displays a waving flag with an SGI logo trimmed out of it. The flag is a single nurbs surface (bicubic, bezier). It "waves" by making it control point oscillate on a sine wave. The logo is cut from the flag using a combination of piecewise-linear and bezier trim curves. sgiflag.zip
shadow.jpg Real-time soft shadows. Press 'h' for a help menu. Drag the middle mouse button to rotate the scene. shadow.zip
signal.jpg Demonstration of picking and rendering luminous objects. Drag the middle mouse button to spin the object. Move the mouse over the bulbs to light them. signal.zip
simplecap.jpg Simple demonstration of using OpenGL's stencil test to cap clipped objects. simplecap.zip
simpleci.jpg Simple program that shows how to do multi-colored material lighting in color index mode simpleci.zip
smooth.jpg Wavefront .OBJ file format model reader/writer manipulator. Use the left mouse button to move, middle mouse button to rotate and right mouse button for menu. smooth.zip
texenv.jpg Demonstrates texture environment modes and internal image formats. texenv.zip
vcull.jpg Simple program that demonstrates the vertex array extension. vcull.zip