glxwin(3Tk)glxwin(3Tk)NAMEglxwin - Create and manipulate glxwin widgets
SYNOPSISglxwin pathName ?options?
STANDARD OPTIONS
cursor
See the ``options'' manual entry for details on the standard options.
WIDGET-SPECIFIC OPTIONS
Name: height
Class: Height
Command-Line Switch: -height
Specifies the desired height for the window in any of the forms
acceptable to Tk_GetPixels. If this option is less than or equal to
zero then the window will not request any size at all.
Name: width
Class: Width
Command-Line Switch: -width
Specifies the desired width for the window in any of the forms
acceptable to Tk_GetPixels. If this option is less than or equal to
zero then the window will not request any size at all.
Name: rgbMode
Class: RgbMode
Command-Line Switch: -rgbmode
This boolean specifies the color mode of the main GL window. By
default, this window will be in color map (cmap) mode. Setting this
option to true specifies that the window should be in RGB mode.
This command line switch can also be used to configure individual
buffer windows (see BUFFER COMMANDS below).
Name: doubleBuffer
Class: DoubleBuffer
Command-Line Switch: -doublebuffer
This boolean specifies whether of not the main GL window should be
double buffered. By default, it is not. This command line switch
can also be used to configure individual buffer windows (see BUFFER
COMMANDS below).
Page 1
glxwin(3Tk)glxwin(3Tk)
Name: stencilSize
Class: StencilSize
Command-Line Switch: -stencilsize
Specifies the size (in bits) of the GL stencil buffer for the main
GL window. If queried, the value of this option will reflect the
actual configuration of the window, not necessarily the
configuration that was requested. By default, the value is 0, which
means don't request that the stencil size be set at all. A value of
-1 is special in that it sets the size of the buffer to the symbolic
constant GLX_NOCONFIG, which in turn sets the buffer to be the
largest size for a particular hardware platform. This command line
switch can also be used to configure individual buffer windows (see
BUFFER COMMANDS below).
Name: accumSize
Class: AccumSize
Command-Line Switch: -accumsize
Same as for stencilSize, but instead refers to the size of the GL
accumulation buffer for the main GL window. By default, the value is
0, which means don't request that the accumulation buffer size be
set at all. A value of -1 is special in that it sets the size of the
buffer to the symbolic constant GLX_NOCONFIG, which in turn sets the
buffer to be the largest size for a particular hardware platform.
This command line switch can also be used to configure individual
buffer windows (see BUFFER COMMANDS below).
Name: zbufferSize
Class: ZbufferSize
Command-Line Switch: -zbuffersize
Same as for stencilSize, but instead refers to the size of the GL Z
buffer. By default, the value is 0, which means don't request that
the zbuffer size be set at all. A value of -1 is special in that it
sets the size of the buffer to the symbolic constant GLX_NOCONFIG,
which in turn sets the buffer to be the largest size for a
particular hardware platform. This command line switch can also be
used to configure individual buffer windows (see BUFFER COMMANDS
below).
Name: bufferSize
Class: BufferSize
Command-Line Switch: -buffersize
Same as for stencilSize, but instead refers to the size of the main
GL buffer. A value of -1 is special in that it sets the size of the
buffer to the symbolic constant GLX_NOCONFIG, which in turn sets the
buffer to be the largest size for a particular hardware platform.
Page 2
glxwin(3Tk)glxwin(3Tk)
The default value is -1. This command line switch can also be used
to configure individual buffer windows (see BUFFER COMMANDS below).
Name: ref
Class: Ref
Command-Line Switch: -ref
Assigns an reference name to the widget. This reference name (or
``ref'' for short) can be used to access information about the
widget's configuration and to manipulate the widget from inside of
imbedded C code.
DESCRIPTION
The glxwin command creates a new window (given by the pathName argument)
and makes it into a glxwin widget.
Additional options, described above, may be specified on the command line
or in the option database to configure aspects of the glxwin. The glxwin
command returns the path name of the new window.
The glxwin widget provides access to a window usable by the Silicon
Graphics GL library from Tk. It uses a user-provided description of GL
window characteristics to initialize the GLX interface and to create an X
window with appropriate visual type and depth. The X window is linked to
GL (using the GLXlink() and GLXwinset() function calls) the first time
the window is mapped. No GL functions are directly supported by glxwin.
Rather, a user's Tk script calls Tcl functions that in turn invoke GL
drawing code written in C. Access to window events are provided by the
standard Tk event binding mechanism; the user is responsible for handling
all events.
The glxwin widget supports imaging in all of the planes of the
framebuffer, including the normal, overlay, underlay, and popup planes.
These planes can be manipulated using commands such as .glx overlay
create and .glx popup config. If windows are created in framebuffer
planes auxiliary to the main window (which exists in the ``normal''
planes), the size of those windows automatically tracks the size of the
main window when the window is resized.
An additional mechanism called ``refs'' provides access to a glxwin
window from C. A ``ref'' is a functional name for a window, distinct
from and complimentary to is Tk (or structural) name. By default,
windows have no ref. If a widget is configured with the -ref refname
option, refname becomes uniquely associated with that widget. The user's
imbedded C code can use the ref name as a key to retrieve information
about the window's GL and X configuration and to choose the current
render window. For example:
Page 3
glxwin(3Tk)glxwin(3Tk)
Display *d;
Window w, ow;
int zbuf_size;
char *ref = "render_window";
if(TkGLXwin_RefExists(ref)) {
d = TkGLXwin_RefGetDisplay(ref);
w = TkGLXwin_RefGetWindow(ref, GLX_NORMAL);
ow = TkGLXwin_RefGetWindow(ref, GLX_OVERLAY);
/* do something with the windows */
/* find the zbuffer size */
zbuf_size = TkGLXwin_RefGetParam(ref, GLX_NORMAL, GLX_ZSIZE);
/* select the overlay planes */
TkGLXwin_RefWinset(ref, GLX_OVERLAY);
}
WIDGET COMMAND
The glxwin command creates a new Tcl command whose name is the same as
the path name of the glxwin's window. This command may be used to invoke
various operations on the widget. It has the following general form:
pathName option ?arg arg ...? PathName is the name of the command, which
is the same as the glxwin widget's path name. Option and the args
determine the exact behavior of the command. The following commands are
possible for glxwin widgets:
pathName configure ?option? ?value option value ...?
Query or modify the configuration options of the widget. If no
option is specified, returns a list describing all of the available
options for pathName (see Tk_ConfigureInfo for information on the
format of this list). If option is specified with no value, then
the command returns a list describing the one named option (this
list will be identical to the corresponding sublist of the value
returned if no option is specified). If one or more option-value
pairs are specified, then the command modifies the given widget
option(s) to have the given value(s); in this case the command
returns an empty string.
Option may have any of the values accepted by the glxwin command.
pathName winset
Establish the GL window associated with this widget as the
application's current drawing window. When a glxwin widget is
created, it becomes the current drawing widget. This option allows
several GL windows to be used in a single application.
pathName islinked
Returns 1 if the X window associated with the widget has been linked
to GL, 0 if is hasn't. No rendering should be done into a window
before the window has been linked.
Page 4
glxwin(3Tk)glxwin(3Tk)
pathName ref ?refname?
Query or modify the ref name of the widget. If no refname is not
specified, returns the ref associated with the GLX widget. If no
ref is associated with the widget, an empty string is returned. If
refname is given, the ref for the widget is set to be that string.
If refname is the empty string, no ref is associated with the
widget.
pathName installcolormaps
Explicitly set the WM_COLORMAP_WINDOWS property on the widget's
toplevel window to include all existing windows in this widget.
Setting this property tells the window manager to install the
colormap of this window at appropriate times.
GLXwin automatically tries to set this property when the widget is
created (and to modify it when the window is destroyed). However,
other packages may modify the WM_COLORMAP_WINDOWS property also,
perhaps removing the GLXwin windows from the list. installcolormaps
will put them back in as friendly a way as possible.
pathName uninstallcolormaps
Remove all windows associated with this widget from the
WM_COLORMAP_WINDOWS property list on the widget's toplevel window.
This command should be used to clean up an explicitly installed
colormap when the widget is deleted. Normally, explicit
deinstallation isn't necessary.
pathName buffername option ?arg arg ...?
Query or modify the window located in a particular set of
framebuffer planes. Buffername can be either normal, overlay,
underlay, or popup. Further options to this command will perform
operations on the selected window type.
BUFFER COMMANDS
pathName buffername ?create? option ?value option value ...?
Create a window in one of the auxiliary planes of the GL
framebuffer. Option can be any valid buffer configuration option as
described below.
pathName buffername ?configure? option ?value option value ...?
Query or modify the window located in buffername. Many of the
options used to configure the normal window (using pathName
configure) can also be used to configure individual buffer windows.
GLXwin called GLXgetconfig() immediately to try and statisfy the
request, but the configuration may be modified by hardware
limitations and later configure calls. After configuration is
complete, the user should confirm the configuration by requesting
the size of a buffer.
Page 5
glxwin(3Tk)glxwin(3Tk)
pathName buffername exists
Returns 1 if buffername currently exists in the configuration for a
given window, 0 if it does not. The window itself may not yet
exist, however.
pathName buffername id
Returns the X window ID for the window in buffername associated with
the widget. If the buffer exists but the window does not (yet),
returns the empty string.
pathName buffername winset
Sets the current GL rendering window to be the window in buffername
associated with the widget.
BINDINGS
When a new glxwin is created, it has no default event bindings. The user
is responsible for handling all events, particularly Expose events.
Configure events should be caught and the results fed to the GL function
viewport().
KEYWORDS
glxwin, GL, widget
Page 6