Next | Prev | Up | Top | Contents | Index
What are OpenGL Drawing-Area Widgets?
Using an OpenGL drawing-area widget facilitates rendering OpenGL into an X window. The widget
- provides an environment for OpenGL rendering, including a visual and a colormap
- provides a set of callback routines for redrawing, resizing, input, and initialization (see "Using Drawing-Area Widget Callbacks")
OpenGL provides two drawing-area widgets: GLwMDrawingArea--note the M in the name--for use with IRIS IM (or with OSF/Motif), and GLwDrawingArea for use with any other widget sets. Both drawing-area widgets provide two convenience functions:
- GLwMDrawingAreaMakeCurrent() and GLwDrawingAreaMakeCurrent()
- GLwMDrawingAreaSwapBuffers() and GLwDrawingAreaSwapBuffers()
The functions allow you to supply a widget instead of the display and window required by the corresponding GLX functions glXMakeCurrent() and glXSwapBuffers().
Because the two widgets are nearly identical, and because IRIS IM is available on all Silicon Graphics systems, this chapter uses only the IRIS IM version, even though most of the information also applies to the general version. Here are some of the distinguishing characteristics of GLwMDrawingArea:
- GLwMDrawingArea understands IRIS IM keyboard traversal (moving around widgets with keyboard keys rather than a mouse), although keyboard traversal is turned off by default.
- GLwMDrawingArea is a subclass of the IRIS IM XmPrimitive widget, not a subclass of the Xt Core widget. It therefore has various defaults such as background and foreground colors. GLwMDrawingArea is not derived from the standard Motif drawing-area widget class. (See O'Reilly Volume One or the reference pages for Core and for XmPrimitive for more information.)
Note that the default background colors provided by the widget are used during X rendering, not during OpenGL rendering, so it's not advisable to rely on default background rendering from the widget. Even when the background colors are not used directly, XtGetValues() can be used to query them to allow the graphics to blend in better with the program.
- GLwMDrawingArea has an IRIS IM style creation function, GLwCreateMDrawingArea(); you can also create the widget directly through Xt.
For information specific to GLwDrawingArea, see the reference page.
Next | Prev | Up | Top | Contents | Index