The togl command creates a new Tk widget, a Tcl command, whose name is pathName. This command may be used to invoke various operations on the widget.
togl pathName [options]
If no options are given, a 400 by 400 pixel RGB window is created.
This command may be used to invoke various operations on the widget.
pathName cget -option
pathName configure
pathName configure -option
pathName configure -option value
pathName contexttag
pathName extensions
would check if the GL_EXT_bgra extension were supported.if {[lsearch [pathName extensions] GL_EXT_bgra] != -1]} { .... }
pathName postredisplay
pathName render
pathName swapbuffers
pathName makecurrent
pathName copycontextto toPathName mask
pathName takephoto imagename
These functions provide an interface to the simple bitmap font capabilities that every OpenGL implementation provides. Better font support is found in other packages, e.g., Tcl3D or with different C APIs.
pathName loadbitmapfont font
pathName unloadbitmapfont toglfont
pathName write toglfont [-pos xyzw] [-color rgba] string
pathName uselayer layer
makecurrent
command
that makes the overlay OpenGL context current
if layer is 2
and makes the normal OpenGL context current
if layer is 1.
pathName showoverlay
pathName hideoverlay
pathName postredisplayoverlay
pathName renderoverlay
pathName existsoverlay
pathName ismappedoverlay
pathName getoverlaytransparentvalue
pathName drawbuffer mode
pathName clear mask
pathName frustum left right bottom top near far
pathName ortho left right bottom top near far
pathName numeyes
pathName configure
command (see above).
Option | Default | Comments |
---|---|---|
-createcommand |
{} |
Can be abbreviated -create .
|
-displaycommand |
{} |
Can be abbreviated -display .
|
-reshapecommand |
{} |
Can be abbreviated -reshape .
|
-destroycommand |
{} |
Can be abbreviated -destroy .
|
-overlaydisplaycommand |
{} |
Can be abbreviated -overlaydisplay .
|
Option | Default | Comments |
---|---|---|
-width |
400 | Set width of widget in pixels. It may have any of the forms accepted by Tk_GetPixels. |
-height |
400 | Set height of widget in pixels. It may have any of the forms accepted by Tk_GetPixels(3). |
-setgrid |
0 | Turn on gridded geometry management for togl widget's toplevel window and specify the geometry of the grid. See the manual pages for Tk's wm(n) and Tk_SetGrid(3) for more information. Unlike the text widget, the same value is used for both width and height increments. |
Option | Default | Comments |
---|---|---|
-time |
1 | Specifies the interval, in milliseconds, for calling the timer callback function which was registered with -timercommand. |
-timercommand |
{} |
Can be abbreviated -timer .
|
Option | Default | Comments |
---|---|---|
-eyeseparation |
2.0 | Set the distance between the eyes in viewing coordinates. |
-convergence |
30.0 | Set the distance to the screen from the eye in viewing coordinates (the distance at which the eyes converge). |
You'd think these values would be given in physical units, but there's no single right way to convert to viewing coordinates from physical units. So if you're willing to use Tk's idea of the horizontal size of a window in millimeters (not always correct), you could convert the average eye separation of 63 mm to your viewing coordinates, and use that value as the eye separation.
Option | Default | Comments |
---|---|---|
-cursor |
"" | Set the cursor in the widget window. |
-swapinterval |
1 | Set the minimum swap interval measure in video frame periods. The default is 1 for for non-tearing artifacts when swapping buffers. Use a value of 0 when benchmarking frame rates. |
-ident |
"" |
A user identification string. This is used match widgets
for the -sharecontext
and the -sharelist options (see below).
This is also useful in your callback functions
to determine which Togl widget is the caller.
|
Option | Default | Comments |
---|---|---|
-rgba |
true | If true, use RGB(A) mode, otherwise use Color Index mode. |
-redsize |
1 | Minimum number of bits in red component. |
-greensize |
1 | Minimum number of bits in green component. |
-bluesize |
1 | Minimum number of bits in blue component. |
-alpha |
1 |
If true and -rgba is true, request an alpha channel.
|
-alphasize |
1 | Minimum number of bits in alpha component. |
-double |
false | If true, request a double-buffered window, otherwise request a single-buffered window. |
-depth |
false | If true, request a depth buffer. |
-depthsize |
1 | Minimum number of bits in depth buffer. |
-accum |
false | If true, request an accumulation buffer. |
-accumredsize |
1 | Minimum number of bits in accumulation buffer red component. |
-accumgreensize |
1 | Minimum number of bits in accumulation buffer green component. |
-accumbluesize |
1 | Minimum number of bits in accumulation buffer blue component. |
-accumalphasize |
1 | Minimum number of bits in accumulation buffer alpha component. |
-stencil |
false | If true, request a stencil buffer. |
-stencilsize |
1 | Minimum number of bits in stencil component. |
-auxbuffers |
0 | Desired number of auxiliary buffers. |
-privatecmap |
false | Only applicable in color index mode. If false, use a shared read-only colormap. If true, use a private read/write colormap. |
-overlay |
false | If true, request overlay planes. |
-stereo |
mode |
See the stereo information
for details about the various modes.
Stereo parameters are changed with the
stereo options.
When using a non-native stereo mode, the OpenGL glDrawBuffer, glClear, glFrustum, and glOrtho calls must be replaced with the Togl Tcl or C versions. |
-pbuffer |
false | If true, request off-screen framebuffer memory for the graphics. The resulting togl widget should not be managed. |
-largestpbuffer |
false | If true, when asking for a pbuffer of a given size and there isn't enough framebuffer memory available, fallback to the largest size available. |
-multisample |
false | If true, request an multisampled rendering context. |
-indirect |
false | If present, request an indirect rendering context. A direct rendering context is normally requested. Only significant on Unix/X11. |
-sharelist |
"" | Togl identification string or window path name of an existing Togl widget with which to share display lists. If it is not possible to share display lists between the two togl widgets (depends on the graphics driver and the particular formats), it fails. |
-sharecontext |
"" | Togl identification string or window path name of an existing Togl widget with which to share the OpenGL context. Note: all other pixel format options are ignored. |
-pixelformat |
0 | Set the pixel format to the (platform-dependent) given value. This is a backdoor into choosing a particular pixel format that was determined by other means. |