Component for OpenGL rendering. More...
#include <Inventor/Xt/SoXtGLWidget.h>
Public Types | |
enum | FloatColorBufferSize { FLOAT_16_COLOR_BUFFER = SoGuiGLWidget::FLOAT_16_COLOR_BUFFER , FLOAT_32_COLOR_BUFFER = SoGuiGLWidget::FLOAT_32_COLOR_BUFFER } |
FloatColorBufferSize. More... | |
Public Member Functions | |
int | getColorMapSize () |
Returns the color map size. | |
virtual Window | getNormalWindow () |
Gets the current normal GL window, which is needed as an argument to glXMakeCurrent() when drawing in the normal planes. | |
SbGlContextHelper::GLContext | getNormalContext () const |
Gets the current normal context, which is needed as an argument to glXMakeCurrent() when drawing in the normal planes. | |
SoGLContext * | getNormalSoContext () const |
SoWidget | getNormalWidget () const |
Gets the current normal widget, which is needed as an argument to glXMakeCurrent() when drawing in the normal planes. | |
virtual void | setNormalVisual (XVisualInfo *vis) |
Specify exactly what the visual should be for the normal window. | |
XVisualInfo * | getNormalVisual () |
Returns the visual for the normal window. | |
virtual void | setDoubleBuffer (SbBool onOrOff) |
Routine that dynamically changes between single and double buffering. | |
SbBool | isDoubleBuffer () |
Returns whether double buffering is on or off. | |
void | setAntialiasing (const float quality, const SoSceneManager::AntialiasingMode mode=SoSceneManager::AUTO) |
Enable (or disable) antialiasing with specified quality and mode. | |
void | setAntialiasing (SoAntialiasingParameters *advancedParameters) |
Enable (or disable) antialiasing with specific parameters. | |
float | getAntialiasingQuality () const |
Returns the antialiasing quality set using the setAntialiasing(float,AntialiasingMode) method. | |
SoSceneManager::AntialiasingMode | getAntialiasingMode () const |
Returns the antialiasing mode set using the setAntialiasing(float,AntialiasingMode) method. | |
SoAntialiasingParameters * | getAntialiasingParameters () const |
Returns the antialiasing parameters set using the setAntialiasing(SoAntialiasingParameters*) method. | |
void | setBorder (SbBool onOrOff) |
Shows/hides a border of thickness 3 around the glX widgets. | |
SbBool | isBorder () const |
Returns whether the border is on or off. | |
void | setDrawToFrontBufferEnable (SbBool enableFlag) |
Sets drawing to the front buffer. | |
SbBool | isDrawToFrontBufferEnable () const |
Queries drawing to the front buffer. | |
virtual SbBool | bindNormalContext () |
Makes the normal rendering context the current context. | |
virtual SbBool | unbindNormalContext () |
unbind the current context (previously bind with bindNormalContext ); | |
virtual SbBool | swapNormalBuffers () |
Swaps the normal front and back buffers. | |
SoGLGraphicConfigTemplate * | getGraphicConfigTemplate () |
Gets the current graphics configuration template. | |
void | setGraphicConfigTemplate (SoGLGraphicConfigTemplate *gTemplate) |
Sets a new graphics configuration template. | |
void | setFloatingColorBuffer (SbBool enable, FloatColorBufferSize size=FLOAT_16_COLOR_BUFFER) |
Enables/disables floating point rendering using 16- or 32-bit components. | |
void | getFloatingColorBuffer (SbBool &enable, FloatColorBufferSize &size) |
Returns TRUE if floating point rendering is used and its precision. | |
bool | saveSnapshot (const SbString &filename, bool overwrite=true) |
Save a snapshot of the current image displayed in the viewer. | |
Public Member Functions inherited from SoXtComponent | |
virtual void | show () |
This shows the component. | |
virtual void | hide () |
This hides the component. | |
SbBool | isVisible () |
Returns TRUE if this component is mapped onto the screen. | |
SoWidget | getWidget () const |
This returns the base widget for this component. | |
SbBool | isTopLevelShell () const |
Returns TRUE if this component is a top level shell component (has its own window). | |
SoWidget | getShellWidget () const |
Returns the shell widget (NULL if the shell hasn't been created by this component). | |
SoWidget | getParentWidget () const |
Returns the parent widget, be it a shell or not. | |
void | setSize (const SbVec2s &size) |
Convenience routine on the widget. | |
SbVec2s | getSize () |
Convenience routine on the widget. | |
SbBool | setFullScreen (const SbBool enable) |
Switches the viewer into (or out of) fullscreen mode. | |
SbBool | isFullScreen (void) const |
Queries if the viewer is in fullscreen mode. | |
void | setFullScreenEnable (const SbBool enable) |
Enables/disables fullscreen mode. | |
SbBool | isFullScreenEnable () const |
Queries if it is possible to put the viewer in fullscreen mode. | |
Display * | getDisplay () |
Returns the X display associated with this components widget. | |
SoNONUNICODE void | setTitle (const char *newTitle) |
Sets window title. | |
void | setTitle (const SbString &newTitle) |
Sets window title. | |
SbString | getTitle () const |
Gets window title. | |
SoNONUNICODE void | setIconTitle (const char *newIconTitle) |
Sets icon title. | |
void | setIconTitle (const SbString &newIconTitle) |
Sets icon title. | |
SbString | getIconTitle () const |
Gets icon title. | |
void | setWindowCloseCallback (SoXtComponentCB *func, void *data=NULL) |
Sets which callback to call when the user closes this component (double click in the upper left corner) - by default hide() is called on this component, unless a callback is set to something other than NULL. | |
SbString | getWidgetName () const |
Returns the widget name. | |
SbString | getClassName () const |
Returns the class name. | |
Additional Inherited Members | |
Static Public Member Functions inherited from SoXtComponent | |
static void | displayHelp (const char *filename, UINT contextID) |
Static method to display the specified topic of the specified help file. | |
static SoXtComponent * | getComponent (SoWidget w) |
This returns the SoXtComponent for this widget. | |
Component for OpenGL rendering.
This abstract base class provides a C++ wrapper around the GLwMDraw window object. It allows OpenGL rendering to be performed within a Motif window and is used by the SoXtRenderArea. SoXtGLWidget uses a parent window with two separate GLwMDraw window objects (one for single and one for double buffering), with routines to return the appropriate windows.
Subclasses only need to redefine the redraw() routine for rendering and processEvent() routine if they are interested in receiving X events.
Definition at line 102 of file SoXtGLWidget.h.
enum SoXtGLWidget::FloatColorBufferSize |
FloatColorBufferSize.
Enumerator | |
---|---|
FLOAT_16_COLOR_BUFFER | 16-bit rendering per component. |
FLOAT_32_COLOR_BUFFER | 32-bit rendering per component. |
Definition at line 108 of file SoXtGLWidget.h.
|
virtual |
Makes the normal rendering context the current context.
Equivalent to makeNormalCurrent() call.
SoSceneManager::AntialiasingMode SoXtGLWidget::getAntialiasingMode | ( | ) | const |
Returns the antialiasing mode set using the setAntialiasing(float,AntialiasingMode) method.
Returns AUTO by default. Parameters set using the setAntialiasing(SoAntialiasingParameters*) method may change the antialiasing mode, but do not affect the value returned by this method. Therefore this method does not necessarily return the current actual antialiasing mode.
SoAntialiasingParameters * SoXtGLWidget::getAntialiasingParameters | ( | ) | const |
Returns the antialiasing parameters set using the setAntialiasing(SoAntialiasingParameters*) method.
Returns null by default. A quality value set using the setAntialiasing(float,AntialiasingMode) method may modify internal parameters, but does not affect the value returned by this method. Therefore this method does not necessarily return the current actual antialiasing parameters.
float SoXtGLWidget::getAntialiasingQuality | ( | ) | const |
Returns the antialiasing quality set using the setAntialiasing(float,AntialiasingMode) method.
Returns 0.0 by default. Parameters set using the setAntialiasing(SoAntialiasingParameters*) method override internal parameters, but do not affect the value returned by this method. Therefore this method does not necessarily return the current actual antialiasing quality.
int SoXtGLWidget::getColorMapSize | ( | ) |
Returns the color map size.
void SoXtGLWidget::getFloatingColorBuffer | ( | SbBool & | enable, |
FloatColorBufferSize & | size | ||
) |
Returns TRUE if floating point rendering is used and its precision.
SoGLGraphicConfigTemplate * SoXtGLWidget::getGraphicConfigTemplate | ( | ) |
Gets the current graphics configuration template.
SbGlContextHelper::GLContext SoXtGLWidget::getNormalContext | ( | ) | const |
Gets the current normal context, which is needed as an argument to glXMakeCurrent() when drawing in the normal planes.
Note: This should not be cached by users because it will change as single/double buffering changes.
SoGLContext * SoXtGLWidget::getNormalSoContext | ( | ) | const |
XVisualInfo * SoXtGLWidget::getNormalVisual | ( | ) |
Returns the visual for the normal window.
SoWidget SoXtGLWidget::getNormalWidget | ( | ) | const |
Gets the current normal widget, which is needed as an argument to glXMakeCurrent() when drawing in the normal planes.
Note: This should not be cached by users because it will change as single/double buffering changes.
|
virtual |
Gets the current normal GL window, which is needed as an argument to glXMakeCurrent() when drawing in the normal planes.
Note: This should not be cached by users because it will change as single/double buffering changes.
|
inline |
Returns whether the border is on or off.
Definition at line 219 of file SoXtGLWidget.h.
SbBool SoXtGLWidget::isDoubleBuffer | ( | ) |
Returns whether double buffering is on or off.
|
inline |
Queries drawing to the front buffer.
Definition at line 230 of file SoXtGLWidget.h.
bool SoXtGLWidget::saveSnapshot | ( | const SbString & | filename, |
bool | overwrite = true |
||
) |
Save a snapshot of the current image displayed in the viewer.
The image is read back from the OpenGL framebuffer and will be the same size as the viewer's drawing window. Returns true if successful.
Notes:
filename | Fully qualified file path for the snapshot file. The specified filename must end with one of the extensions supported by SoJPEGImageRW (jpg, jpeg, ...), SoPNGImageRW (png), SoBMPImageRW (bmp), or SoTIFFImageRW (tif, ...). |
overwrite | If true, overwrite any existing file with the same name (default is true). |
void SoXtGLWidget::setAntialiasing | ( | const float | quality, |
const SoSceneManager::AntialiasingMode | mode = SoSceneManager::AUTO |
||
) |
Enable (or disable) antialiasing with specified quality and mode.
Specific antialiasing parameters will be set automatically based on the quality value. Note that the quality and mode settings are overridden if specific antialiasing parameters are subsequently set using the setAntialiasing(SoAntialiasingParameters*) method.
The default mode is AUTO but this may be overridden by setting the environment variable OIV_ANTIALIASING_DEFAULT_MODE (see SoPreferences).
quality | The quality is a factor in the range [0.0,1.0]. Use the value 0.0 to turn off antialiasing. 0.5 is a typical value. |
mode | The antialiasing algorithm. Default is AUTO, which means use the best for the current hardware. Use the value NO_ANTIALIASING to turn off antialiasing. |
void SoXtGLWidget::setAntialiasing | ( | SoAntialiasingParameters * | advancedParameters | ) |
Enable (or disable) antialiasing with specific parameters.
Use one of the subclasses of SoAntialiasingParameters. The antialiasing mode is determined by which subclass is used to set the parameters. For example, passing an SoFXAAParameters object automatically sets FXAA mode. Note that the parameters are overridden if a quality and mode are subsequently set using the setAntialiasing(float,AntialiasingMode) method.
advancedParameters | Provides specific parameters for an antialiasing mode. Use a null parameter to turn off antialiasing or use one of the subclasses of SoAntialiasingParameters. |
void SoXtGLWidget::setBorder | ( | SbBool | onOrOff | ) |
Shows/hides a border of thickness 3 around the glX widgets.
This if OFF by default, but turned on by the render area.
|
virtual |
Routine that dynamically changes between single and double buffering.
Default is double buffer off. (The SoXtRenderArea subclass makes it double buffer by default.)
void SoXtGLWidget::setDrawToFrontBufferEnable | ( | SbBool | enableFlag | ) |
Sets drawing to the front buffer.
Controls drawing to the front buffer when an obscured portion of the window is exposed. Default: TRUE.
void SoXtGLWidget::setFloatingColorBuffer | ( | SbBool | enable, |
FloatColorBufferSize | size = FLOAT_16_COLOR_BUFFER |
||
) |
Enables/disables floating point rendering using 16- or 32-bit components.
If TRUE, Open Inventor will automatically render to an offscreen floating point buffer, and copy the resulting image to the screen.
To determine if floating point rendering was successfully enabled, use getFloatingColorBuffer, below.
Using floating point rendering can improve image quality, particularly when many objects are being blended, for example, in volume rendering. This is a convenience method as you could accomplish the same results setting up a graphic template.
void SoXtGLWidget::setGraphicConfigTemplate | ( | SoGLGraphicConfigTemplate * | gTemplate | ) |
Sets a new graphics configuration template.
|
virtual |
Specify exactly what the visual should be for the normal window.
This allows the user to create all possible visuals supported by OpenGL. The XVisualInfo structure should be a valid OpenGL visual returned by glXChooseVisual (). This structure will be copied by the SoXtGLWidget; the application is responsible for freeing the visual info with XFree () when done. (The methods for setting the visual are virtual so that derived classes can know when the visual is changing.)
|
virtual |
Swaps the normal front and back buffers.
Equivalent to calling glXSwapBuffers( getDisplay(), getNormalWindow() );
|
virtual |
unbind the current context (previously bind with bindNormalContext );