Coin Logo http://www.sim.no
http://www.coin3d.org

SoXtGLWidget Class Reference
[Xt Components]

#include <Inventor/Xt/SoXtGLWidget.h>

Inheritance diagram for SoXtGLWidget:

SoXtComponent SoXtObject SoXtRenderArea SoXtViewer SoXtFullViewer SoXtConstrainedViewer SoXtExaminerViewer SoXtPlaneViewer SoXtFlyViewer List of all members.

Detailed Description

The SoXtGLWidget class manages OpenGL contexts.

This is the basic, abstract component class which sets up an OpenGL canvas for its subclasses.

Application programmers will normally not use this class directly, but rather through the interface of either its direct descendent; SoXtRenderArea, or through one of the "rapid application development"-style viewer subclasses.


Public Member Functions

void setBorder (const SbBool enable)
SbBool isBorder (void) const
virtual void setDoubleBuffer (const SbBool enable)
SbBool isDoubleBuffer (void) const
void setDrawToFrontBufferEnable (const SbBool enable)
SbBool isDrawToFrontBufferEnable (void) const
void setQuadBufferStereo (const SbBool enable)
SbBool isQuadBufferStereo (void) const
void setAccumulationBuffer (const SbBool enable)
SbBool getAccumulationBuffer (void) const
void setStencilBuffer (const SbBool enable)
SbBool getStencilBuffer (void) const
void setAlphaChannel (const SbBool enable)
SbBool getAlphaChannel (void) const
void setOverlayRender (const SbBool onoff)
SbBool isOverlayRender (void) const
void setStealFocus (SbBool enable)
SbBool isStealFocus (void) const
Widget getGLWidget (void) const
Widget getNormalWidget (void) const
Widget getOverlayWidget (void) const
SbBool hasOverlayGLArea (void) const
SbBool hasNormalGLArea (void) const
unsigned long getOverlayTransparentPixel (void)
void getPointSizeLimits (SbVec2f &range, float &granularity)
void getLineWidthLimits (SbVec2f &range, float &granularity)
GLXContext getNormalContext (void)
GLXContext getOverlayContext (void)
Window getNormalWindow (void)
Window getOverlayWindow (void)
int getOverlayColorMapSize (void)
int getColorMapSize (void)
virtual void setNormalVisual (XVisualInfo *visual)
XVisualInfo * getNormalVisual (void)
virtual void setOverlayVisual (XVisualInfo *visual)
XVisualInfo * getOverlayVisual (void)

Protected Member Functions

 SoXtGLWidget (Widget const parent=NULL, const char *const name=NULL, const SbBool embed=TRUE, const int glmodes=SO_GL_RGB, const SbBool build=TRUE)
 ~SoXtGLWidget ()
virtual void processEvent (XAnyEvent *event)
Widget buildWidget (Widget parent)
virtual void redraw (void)=0
virtual void redrawOverlay (void)
virtual void initGraphic (void)
virtual void initOverlayGraphic (void)
virtual void sizeChanged (const SbVec2s &size)
virtual void widgetChanged (Widget w)
void setGLSize (const SbVec2s size)
SbVec2s getGLSize (void) const
float getGLAspectRatio (void) const
void setGlxSize (const SbVec2s size)
SbVec2s getGlxSize (void) const
float getGlxAspectRatio (void) const
void setStereoBuffer (SbBool flag)
SbBool isStereoBuffer (void) const
SbBool isRGBMode (void)
void glLockNormal (void)
void glUnlockNormal (void)
void glLockOverlay (void)
void glUnlockOverlay (void)
void glSwapBuffers (void)
void glFlushBuffer (void)
virtual SbBool glScheduleRedraw (void)
int getDisplayListShareGroup (GLXContext context)
Widget getGlxMgrWidget (void)

Static Protected Member Functions

static void eventHandler (Widget, SoXtGLWidget *, XAnyEvent *, Boolean *)

Protected Attributes

SbBool waitForExpose
SbBool drawToFrontBuffer

Friends

class SoGuiGLWidgetP
class SoXtGLWidgetP


Constructor & Destructor Documentation

SoXtGLWidget::SoXtGLWidget ( Widget const   parent = NULL,
const char *const   name = NULL,
const SbBool  embed = TRUE,
const int  glmodes = SO_GL_RGB,
const SbBool  build = TRUE 
) [protected]

The constructor is protected, as this is an abstract class to only be used by it's subclasses.

SoXtGLWidget::~SoXtGLWidget (  )  [protected]

Clean up all use of internal resources.

The destructor is protected, as this is an abstract class to only be used by it's subclasses.


Member Function Documentation

void SoXtGLWidget::setBorder ( const SbBool  enable  ) 

Specify whether or not there should be a border framing the OpenGL canvas. The border will be 2 pixels wide.

The default is to display the OpenGL canvas with no border.

See also:
isBorder()

SbBool SoXtGLWidget::isBorder ( void   )  const

Returns whether or not there's a border framing the OpenGL canvas.

See also:
setBorder()

void SoXtGLWidget::setDoubleBuffer ( const SbBool  enable  )  [virtual]

This method sets whether double buffering is to be used or not.

Reimplemented in SoXtViewer.

SbBool SoXtGLWidget::isDoubleBuffer ( void   )  const

This method returns whether double buffering is used or not.

void SoXtGLWidget::setDrawToFrontBufferEnable ( const SbBool  enable  ) 

This method sets whether rendering will be done to the front buffer or not.

SbBool SoXtGLWidget::isDrawToFrontBufferEnable ( void   )  const

This method returns whether rendering will be done to the front buffer or not.

void SoXtGLWidget::setQuadBufferStereo ( const SbBool  enable  ) 

Enables or disables OpenGL quad buffer stereo.

SbBool SoXtGLWidget::isQuadBufferStereo ( void   )  const

Returns TRUE if quad buffer stereo is enabled for this widget.

void SoXtGLWidget::setAccumulationBuffer ( const SbBool  enable  ) 

Enables/disables the OpenGL accumulation buffer.

SbBool SoXtGLWidget::getAccumulationBuffer ( void   )  const

Returns whether the OpenGL accumulation buffer is enabled.

void SoXtGLWidget::setStencilBuffer ( const SbBool  enable  ) 

Enables/disables the OpenGL stencil buffer.

SbBool SoXtGLWidget::getStencilBuffer ( void   )  const

Returns whether the OpenGL stencil buffer is enabled.

void SoXtGLWidget::setAlphaChannel ( const SbBool  enable  ) 

Enables/disables an alpha channel for the rendering context.

SbBool SoXtGLWidget::getAlphaChannel ( void   )  const

Returns whether the an alpha channel is enabled.

void SoXtGLWidget::setOverlayRender ( const SbBool  onoff  ) 

Turn on or off the use of overlay planes.

See also:
isOverlayRender()

SbBool SoXtGLWidget::isOverlayRender ( void   )  const

Returns a flag indicating whether or not overplay planes are currently used.

See also:
setOverlayRender()

void SoXtGLWidget::setStealFocus ( SbBool  enable  ) 

Sets whether the GL widget should steal keyboard focus when the mouse is over the GL view.

Default is TRUE.

See also:
isStealFocus
Since:
SoXt 1.3.0

SbBool SoXtGLWidget::isStealFocus ( void   )  const

Returns whether focus stealing policy is on (TRUE) or off (FALSE).

Default is TRUE.

See also:
setStealFocus
Since:
SoXt 1.3.0

Widget SoXtGLWidget::getGLWidget ( void   )  const

This method returns the actual GL widget.

Widget SoXtGLWidget::getNormalWidget ( void   )  const

This method returns the Widget associated with the normal GL context.

Widget SoXtGLWidget::getOverlayWidget ( void   )  const

This method returns the Widget associated with the overlay GL context.

SbBool SoXtGLWidget::hasOverlayGLArea ( void   )  const

Should return TRUE if an overlay GL drawing area exists.

SbBool SoXtGLWidget::hasNormalGLArea ( void   )  const

Should return TRUE if a normal GL drawing area exists.

unsigned long SoXtGLWidget::getOverlayTransparentPixel ( void   ) 

This method returns the transparent pixel for the overlay planes.

void SoXtGLWidget::getPointSizeLimits ( SbVec2f &  range,
float &  granularity 
)

This function is provided as a convenience for the application programmer to help with acquiring the OpenGL implementation limits for rendering points.

For robust application code, one needs to consider the range limits when setting the SoDrawStyle::pointSize field.

void SoXtGLWidget::getLineWidthLimits ( SbVec2f &  range,
float &  granularity 
)

This function is provided as a convenience for the application programmer to help with acquiring the OpenGL implementation limits for rendering lines.

For robust application code, one needs to consider the range limits when setting the SoDrawStyle::lineWidth field.

void SoXtGLWidget::processEvent ( XAnyEvent *  anyevent  )  [protected, virtual]

Any events from the native window system that goes to the OpenGL canvas gets piped through this method.

It is overloaded in the subclasses to catch user interaction with the render canvas in the viewers, aswell as forwarding relevant events to the scenegraph.

Reimplemented in SoXtRenderArea.

Widget SoXtGLWidget::buildWidget ( Widget  parent  )  [protected]

This method builds the component contents in the given parent widget. For subclasses adding new user interface items, this method is typically overridden in the following manner:

  Widget MyOwnViewer::buildWidget(Widget parent)
  {
     Widget superw = <superclass>::buildWidget(parent);
     // [then move superw within MyOwnViewer framework and add own
     // user interface components]
  }

Reimplemented in SoXtRenderArea, SoXtFullViewer, and SoXtPlaneViewer.

void SoXtGLWidget::redraw ( void   )  [protected, pure virtual]

This method is invoked when the GL buffer needs to be redrawn.

Implemented in SoXtRenderArea.

void SoXtGLWidget::redrawOverlay ( void   )  [protected, virtual]

This method is invoked when the overlay graphics should be redrawn.

Reimplemented in SoXtRenderArea.

void SoXtGLWidget::initGraphic ( void   )  [protected, virtual]

This method initializes the graphics.

Reimplemented in SoXtRenderArea.

void SoXtGLWidget::initOverlayGraphic ( void   )  [protected, virtual]

This method initializes the overlay graphics.

Reimplemented in SoXtRenderArea.

void SoXtGLWidget::sizeChanged ( const SbVec2s &  size  )  [protected, virtual]

Called internally from within the SoXt library when the widget embedded in a component changes it size, which is usually triggered by end-user interaction.

This method is then invoked to notify the component that the size has changed. It is called from the top and all the way down to the bottom, the size being adjusted to take into account extra decorations having been added at each level in the component class hierarchy.

Reimplemented from SoXtComponent.

Reimplemented in SoXtRenderArea, SoXtViewer, and SoXtFullViewer.

void SoXtGLWidget::widgetChanged ( Widget  w  )  [protected, virtual]

This method is invoked when a widget in the component is changed.

Reimplemented in SoXtRenderArea.

void SoXtGLWidget::setGLSize ( const SbVec2s  size  )  [protected]

This methid sets the size of the GL widget.

SbVec2s SoXtGLWidget::getGLSize ( void   )  const [protected]

This method returns the size of the GL area.

float SoXtGLWidget::getGLAspectRatio ( void   )  const [protected]

This method returns the aspect ratio of the GL area.

void SoXtGLWidget::setGlxSize ( const SbVec2s  size  )  [inline, protected]

This method sets the Glx size.

See also:
setGLSize

SbVec2s SoXtGLWidget::getGlxSize ( void   )  const [inline, protected]

This method returns the size of the Glx area.

See also:
getGLSize

float SoXtGLWidget::getGlxAspectRatio ( void   )  const [inline, protected]

This is the old name for getGLAspectRatio.

See also:
getGLAspectRatio

void SoXtGLWidget::setStereoBuffer ( SbBool  flag  )  [protected]

Sets whether OpenGL stereo buffers (quad buffer stereo) should be used.

SbBool SoXtGLWidget::isStereoBuffer ( void   )  const [protected]

Returns whether OpenGL stereo buffers are being used.

SbBool SoXtGLWidget::isRGBMode ( void   )  [protected]

This method returns whether the GL context is in RGB mode or not.

void SoXtGLWidget::glLockNormal ( void   )  [protected]

This method locks the GL context.

On systems that use GL context locking and unlocking, this method will lock the GL context. On other systems, only makeCurrent will be run.

This method is an SoXt extension.

void SoXtGLWidget::glUnlockNormal ( void   )  [protected]

This method unlocks the GL context.

void SoXtGLWidget::glLockOverlay ( void   )  [protected]

This method locks the GL context.

On systems that use GL context locking and unlocking, this method will lock the GL context. On other systems, only makeCurrent will be run.

This method is an SoXt extension.

void SoXtGLWidget::glUnlockOverlay ( void   )  [protected]

This method unlocks the GL context.

void SoXtGLWidget::glSwapBuffers ( void   )  [protected]

This method swaps the GL buffers.

void SoXtGLWidget::glFlushBuffer ( void   )  [protected]

This method flushes the GL context.

SbBool SoXtGLWidget::glScheduleRedraw ( void   )  [protected, virtual]

Will be called whenever scene graph needs to be redrawn(). If this method return FALSE, redraw() will be called immediately.

Default method simply returns FALSE. Overload this method to schedule a redraw and return TRUE if you're trying to do The Right Thing.

Reimplemented in SoXtRenderArea.

GLXContext SoXtGLWidget::getNormalContext ( void   ) 

Returns the GL context for normal rendering.

See also:
getOverlayContext

GLXContext SoXtGLWidget::getOverlayContext ( void   ) 

Returns the GL context for overlay rendering.

See also:
getNormalContext

Window SoXtGLWidget::getNormalWindow ( void   ) 

This method returns the Window associated with the normal GL context.

Window SoXtGLWidget::getOverlayWindow ( void   ) 

This method returns the Window associated with the overlay GL context.

int SoXtGLWidget::getOverlayColorMapSize ( void   ) 

This method returns the size of the colormap for the overlay planes.

int SoXtGLWidget::getColorMapSize ( void   ) 

This methos returns the size of the colormap for the normal planes.

void SoXtGLWidget::setNormalVisual ( XVisualInfo *  visual  )  [virtual]

This method sets the visual for the normal GL context.

XVisualInfo * SoXtGLWidget::getNormalVisual ( void   ) 

This method returns the visual for the normal GL context.

void SoXtGLWidget::setOverlayVisual ( XVisualInfo *  visual  )  [virtual]

This method sets the visual for the overlay GL context.

XVisualInfo * SoXtGLWidget::getOverlayVisual ( void   ) 

This method returns the visual for the overlay GL context.

void SoXtGLWidget::eventHandler ( Widget  widget,
SoXtGLWidget closure,
XAnyEvent *  event,
Boolean *  dispatch 
) [static, protected]

This method is a callback that dispatches events to processEvent().

See also:
processEvent

int SoXtGLWidget::getDisplayListShareGroup ( GLXContext  context  )  [protected]

This method returns the share group for the display lists for the GL context.

Widget SoXtGLWidget::getGlxMgrWidget ( void   )  [protected]

This method returns the widget that is managing the GL widget.


Member Data Documentation

SbBool SoXtGLWidget::waitForExpose [protected]

If this is TRUE, rendering should not be done yet. Upon the first expose event of a newly created OpenGL widget, this variable will be set to FALSE.

SbBool SoXtGLWidget::drawToFrontBuffer [protected]

If this is TRUE, rendering will happen in the front buffer even if the current rendering mode is double buffered.


The documentation for this class was generated from the following files:

Copyright © 1998-2005 by Systems in Motion AS. All rights reserved.

Generated on Tue Dec 2 23:15:46 2008 for SoXt by Doxygen. 1.4.7