OpenGL Win32 Tutorial Sample Code

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

An example of the minimal Win32 & OpenGL program. It only works in 16 bit color modes or higher (since it doesn't create a palette).

Source code: minimal.c.

Snapshots: triangle (shown).

An example of an OpenGL animation loop using the Win32 API. Also demonstrates palette management for both RGB and Color Index modes and general strategies for message handling.

Source code: animate.c.

Snapshots: rgb mode (shown), color index mode.

An example of processing mouse events in an OpenGL program using the Win32 API.

Source code: mouse.c.

Snapshots: rotated (shown), rotated + translated + zoomed.

An example of using draw pixels and pixel zoom operations in OpenGL using the Win32 API.

Source code: image.c.

Snapshots: opengl (shown).

Simple example of rendering to a Windows DIB (Device Independent Bitmap).

Source code: simpledib.c.

Snapshots: torus (shown).

Simple program that enumerates all of the pixel formats available.

Source code: wglinfo.c.

Snapshots: small output (shown).