GLXAUX(3Tk)GLXAUX(3Tk)NAMEGLXAux - an extension to Tcl/Tk which allows IrisGL rendering
SYNOPSIS
cc -o your_wish yourAppInit.o ... -ltkGLXAux -ltkGLX -ltk -ltcl -lgl_s
-lXext -lX11_s -lm
and, yourAppInit.c should contain:
TkGLX_Init(interp, Tk_MainWindow(interp));
if (TkGLXAux_Init(interp) == TCL_ERROR) {
return TCL_ERROR;
}
DESCRIPTIONGLXAux is a companion extension to glxwin, by Michael Halle
<mhalle@media.mit.edu>. glxwin provides a Tk widget which can be used as
a target of GL rendering. However, often many simple GL tasks would be
easier if they had Tcl bindings. GLXAux provides these bindings - a
comprehensive set of Tcl bindings to IrisGL (GL 4.0). Version 1.0 of
GLXAux supports pretty much everything except lighting and textures. See
the COMMANDS NOT SUPPORTED section for more details.
For most GL commands, the equivalent Tcl command will be the same text,
except prefixed with gl:. So, cpack(3G) would be accessed by running
gl:cpack.
SYNTAX
Most GLXAux commands take exactly the same arguments as their C
counterparts. Some take groups of arguments, such as gl:circ, which
draws a circle. Both of the following commands are equivalent:
gl:circ {10 10} 20
gl:circ 10 10 20
When a GL command occurs in many forms, such as the vertex command (v2i,
v2f, v2d, v3i, v3f, v3d, ...), these have been collapsed into one Tcl
command (in this case, gl:v) which takes a variable number of arguments.
When a GL command takes an Angle argument, which for C programmers is an
integer in tenths of degrees, the Tcl programmer has a choice of degrees,
tenths of degrees, or radians. The current interpretation of an angle is
set with the gl:anglemode command. By default, angles are read as
degrees.
When a GL command would normally return multiple values to addressed
passed to it, such as gRGBcolor(3G), these results are returned together
as a Tcl list.
Page 1
GLXAUX(3Tk)GLXAUX(3Tk)
When a GL command would normally take a boolean value, such as
backbuffer(3G), the Tcl programmer may use numbers (1 or 0) as well as
strings (if it begins with f, F, or 0, it's considered to be false,
otherwise, it's true).
When a GL command would normally take a Matrix, such as loadmatrix(3G),
the Tcl programmer may pass a list of lists, each containing four
numbers. This must be in row-major order.
When a GL command would normally take one of a specific number of
predefined arguments, such as afunction(3G), which, in C, may be passed
either AF_NOTEQUAL or AF_ALWAYS, the Tcl programmer is restricted to use
some lower-case cleaned-up versions of these strings, in this case,
notequal or always. Other strings will generate an error.
CONVENIENCES
The Tcl variable gl:identity contains an identity matrix suitable for
passing to functions like gl:loadmatrix.
The Tcl variable glxaux:version contains the version number of the GLXAux
library (currently 1.0).
The Tcl command gl:view provides a higher-level abstraction for a typical
walk-through application. gl:view works like most Tk commands, i.e.,
gl:view view1 will create a new command, view1 which can then be
manipulated directly.
Usage: gl:view view-name ?configuration-parameters?
view-name get - returns the matrix corresponding to the current
viewing parameters.
view-name load - performs a GL loadmatrix() of the matrix
corresponding to the current viewing parameters.
view-name turn_right angle - turns the viewer's head right, in
the viewer's coordinate system. The units for angle are
determined by the last call to gl:anglemode.
view-name turn_up angle - turns the viewer's up right, in the
viewer's coordinate system. The units for angle are determined
by the last call to gl:anglemode.
view-name walk_forward distance - moves the viewer forward, in
the viewer's coordinate system.
view-name walk_up distance - moves the viewer up, in the viewer's
coordinate system.
view-name walk_right distance - moves the viewer right, in the
viewer's coordinate system.
view-name configure ?configuration-parameters?
Configurable options:
(if no options are passed, the current configuration is returned)
-position {x y z} - sets the viewer's position (VRP) to {x y z}
-forward {x y z} - sets the viewer's direction (VPN) to {x y z}
Page 2
GLXAUX(3Tk)GLXAUX(3Tk)-up {x y z} - sets the viewer's up vector (VUV) to {x y z}
-target {x y z} - fixes the viewer's gaze upon {x y z},
regardless of any change in position. Setting the -forward value
cancels target mode.
PERFORMANCE
These bindings are slow. For tasks that only occur occasionally, like
clearing the screen or changing the viewpoint, there should be no
noticable slowdown. However, for tasks that occur often, like sending a
vertex to the graphics pipeline, the slowdown is quite noticable. You
should really be doing that kind of stuff in C, but it you insist on
using Tcl, use GL objects to encapsulate large collections of primitives.
See the pyramidWorld demo program for an example of this.
COMMANDS NOT SUPPORTED
GL 4.0 contains many features for backward compatibility with older
versions. Many such commands don't make sense with you're using X.
Particularly, the GL font mechanisms and event mechanisms are no longer
used. Likewise, there's no need to use GL menus, since you're using
GLXAux with Tcl/Tk, which provides its own menus. Object editing isn't
supported in GLXAux since it isn't supported in OpenGL, which would make
porting GLXAux difficult.
Some features, such as lighting, materials, NURBS, picking, fogvertex,
feedback, and texture-map/image handing, should appear in a later
release, with a higher-level Tk-style object oriented interface, where
appropriate. The GLXAux 1.0 release is intended to get the work already
accomplished out on the net for people to use today.
Remember, if you need to be using some of these features, you can always
write your code in C.
SUPPORTED COMMANDS
Note: the subpixwindow and subpixperspective calls aren't properly GL
calls but rather can be found in the Graphics Library Programming Guide,
v2.0, pages 15-39. These are useful for accumulation-buffer-based anti-
aliasing.
Page 3