You should have Tcl and Tk installed on your computer. Togl works with Tcl/Tk version 8.1 and up (all recent testing has been with version 8.4). The Mac OS X version requires version 8.4 (note: versions 8.4.12 and 8.4.13 have a bug when unmapping Togl widgets).
You must also have OpenGL or Mesa (a free alternative to OpenGL with the same API) installed on your computer.
And one should be familiar with Tcl, Tk, OpenGL,
and C programming to use Togl effectively.
Togl can be downloaded from SourceForge Files page.
Several prebuilt binary distributions are available as well as a source distribution.
Prebuilt binaries provide a Togl2.0 directory,
the togl.h, togl_ws.h and toglDecls.h include files,
and the togl stub library
(libToglstub2.0.a or Toglstub20.lib, etc).
The Togl2.0 directory needs to copied
into one of the directories on Tcl's package path
(type puts $auto_path
in the Tcl interpreter to see
the list of directories).
If you have C code that needs to access Togl's subroutines directly,
place the include file in the same place as Tcl's include file and
the stub library in the same place as Tcl's stub library.
Togl uses the Tcl Extension Architecture to be able to build on the same platforms Tcl can be built on. In addition to the Togl source, you will need to have the Tcl and Tk source distributions because not all installations have the needed Tcl and Tk internal header files.
How you link with Togl depends on how you're planning to use it. There are basically three ways of using Togl with your application:
make install
)
and link to the Togl stubs library with your executable or shared library.
In this case you must call Togl_InitStubs() (and probably Tcl_InitStubs()
— Tk_InitStubs is only needed if you call Tk functions).
This is the way the included Togl examples are built.
make install
)
and then load it using Tcl commands or Tcl_PkgRequire().
Then use Tcl commands to create and manipulate the Togl widget.
README.stubs
for more info.
Specific platform notes follow:
Unix/X systems only need the public Tcl/Tk include files.
Just configure
, make
,
and optionally make install
.
Windows platforms need tkWinInt.h
and other internal Tk header files. So you need a Tcl/Tk
source distribution in addition to the Togl distribution
(or copy over the various include files).
Here's the minimal way to build Togl with Tcl/Tk using the gcc that is distributed as part of the cygwin tools (Microsoft's compilers work too):
VER=8.4.12
SRCDIR=`pwd`
cd $SRCDIR/tcl$VER/win
env 'CC=gcc -mno-cygwin' ./configure --enable-threads
make libtclstub84.a
cd $SRCDIR/tk$VER/win
env 'CC=gcc -mno-cygwin' ./configure --enable-threads
make libtkstub84.a
cd $SRCDIR/Togl2.0
env 'CC=gcc -mno-cygwin' ./configure --with-tcl=../tcl$VER/win --with-tk=../tk$VER/win
make
The resulting Togl20.dll
and pkgIndex.tcl
should be installed into your Tcl installation just like any other package.
If you change all of the above make
's
to make install
instead,
then the Togl package is installed correctly.
These special instructions are for building the Aqua version of Togl.
Mac OS X needs tkMacOSXInt.h
and other internal Tk header files.
Unfortunately, the Tcl and Tk frameworks that Apple distributes
are missing the internal headers.
So you need a Tcl/Tk source distribution in addition to the Togl
distribution (or copy over the various include files).
You would probably want a newer version of Tcl and Tk anyway
because each minor revision of 8.4 has many Aqua bug fixes.
Here's one way to build Tcl, Tk, and Togl on Mac OS X (assuming they are all in the same directory) to install in your home directory:
VER=8.4.12
mkdir -p ~/bin
make -C tcl$VER/macosx install PREFIX="${HOME}" INSTALL_PATH="${HOME}/Library/Frameworks"
make -C tk$VER/macosx install PREFIX="${HOME}" INSTALL_PATH="${HOME}/Library/Frameworks" APPLICATION_INSTALL_PATH="${HOME}/Applications"
cd Togl2.0
./configure --prefix="${HOME}"
make install
-sharelist
and -sharecontext
config flags
-indirect
config flag
-pixelformat
config flag