Documentation
Not logged in

A 3-D Canvas Widget For Tcl/Tk

Originally written on 2005-08-15. Updated 2008-12-12:

The 3-D Canvas Widget provides Tk programs with 3-D graphics capabilities through the use of OpenGL. But the 3-D Canvas widget is not another thin wrapper around the OpenGL interface. This widget is a much higher-level abstraction. Just as the built-in canvas widget of Tk is a high-level abstraction of the X11 drawing routines, so too the 3-D Canvas widget is a high-level abstraction of OpenGL.

The project is still under active development. The interface is stablizing, but users should be prepared for possible API changes in the future. An interface freeze will likely not occur until the end of 2005 at the earliest. The 3dcanvas project is stable and has been in use and relatively unchanged for several years. New contributors who want to expand and enhance 3dcanvas are welcomed.

The current interface can be seen in the ./3dcanvas.html. The ./3dcanvas.man source code to this file is in the source repository. Source code is available by anonymous CVS fossil. As follows:

fossil clone http://3dcanvas.tcl.tk/fossil 3dcanvas.fossil
mkdir 3dcanvas
cd 3dcanvas
fossil open ../3dcanvas.fossil

Or, if you don't want to mess with installing fossil (fossil is a self-contained, stand-alone binary and precompiled fossil binaries are available, so installation is trivial) then you can download the code as a ZIP archive as follows:

  1. Login as user "anonymous". The password is shown on the login page. (The reason for requiring login is to prevent spiders for downloading every historical version of 3dcanvas.
  1. Go to the timeline page and select a version of 3dcanvas that you want to download. Click on its link.
  1. Find the "ZIP archive" link on the baseline page. This will cause a ZIP archive containing the particular version of 3dcanvas you have selected to be built and downloaded.

Build using the steps shown below. (This procedure works on SuSE 9.2 - likely it also works on most other flavors of Unix.) Precompiled libraries and kits are not yet available but probably will be available within the next few weeks.

  1. Check out the source code from CVS.
  2. Create a sibling directory to the source code named bld.
  3. Check to the bld directory.
  4. Type: ../canvas3d/configure
  5. Type: make
  6. Type: wish ../canvas3d/demo/triangles.tcl

A timeline of changes is available online. There is also a wiki devoted to this widget. The wiki is currently empty but feel free to change that. Use the ticket entry form to report bugs or request new features.

Code contributions are welcomed. Write access to the CVS repository can be arranged by contacting drh@hwaci.com.