Q Solutions

TclOgl Gears Demonstration

© Q Solutions, August 2005


The purpose of this program is to demonstrate using openGL from within Tcl.
The aim is to demonstrate the following:

  1. Creating an scene and rendering it within openG using a Togl widget.
  2. Displaying multiple Togl Widgets and having seperate drawing contexts for each.
  3. The ease of Texture mapping objects.


The first implementation of a GL interface for Tcl was the Togl widget. This provided a framework for creating custom interfaces in C extensions.

Paule Obermeier modified this code to allow the callbacks from Togl to be made to Tcl procs. Along with the TclOgl interface, it allows GL calls to be made from Tcl.

This provides a near complete interface to the GL API from Tcl.


The demo provides buttons to create and remove Togl widgets. Each widget will display the Spinning Gears scene.

The Add button will create a new Togl widget with the attributes specified in the entry field and texture menu buttons.



There is a row of Menu Buttons at the top of the screen, each on is filled in with the names of all loadable images files found in the current directory. Each button corresponds to one gear from largest to smallest. The image None removes the Texture for that gear and renders it in it's base colour.
The menu button specifies the texture for the next Togl widget to be created.

The program scans the current directory for image files. It will use the Img extension if available. The images are turned in Texture vectors that can be assigned to the gears via the Menu buttons at the top of the screen.



Code and inspiration supplied by.


* Currently this version does not allow Tcl callback functions, use the version from the TclOgl site.