OpenGL Code Samples

Code Samples released by SGI with the OpenGL 1.1 distribution in 1997. These are very useful for beginning OpenGL coding and learning OpenGL program structure. Advanced rendering and later extensions are not covered in these examples.

Download All Sample Code as a single Zip file

Simple program to test accumulation.

Source code: accum.c.


Simple program to test bitmap rendering.

Source code: bitmap1.c.


Simple program to test bitmap rendering.

Source code: bitmap2.c.


Program that demonstrates reading back the framebuffer and zooming the pixels.

Source code: copy.c.


Simple program to test depth buffering.

Source code: depth.c.


Not so simple test that does all sorts of stuff (see the source for more details).

Source code: logo.c.


Simple nurb (non-uniform rational b-spline) program.

Source code: nurb.c.


Program that uses packed pixel types for DrawPixels, ReadPixels, TexImage2D, and GetTexImage. Use -h option to display a list of command line options. Use Key h in the created window for key options.

Source code: packedpix.c.


All the OpenGL primitives all in a row.

Source code: prim.c.


Another "megatest" with lots of options.

Source code: quad.c.


Test of auto texture coordinate generation.

Source code: sphere.c.


Neat little warping program. Click in the window to add control points, and press space bar to start warping.

Source code: stretch.c.


Ye 'ole classic (red in this case) teapot.

Source code: teapot.c.


Simple example of using two textures.

Source code: twotextures.c.


Neat wave program with some contouring options (press 'c').

Source code: wave.c.