Component for OpenGL rendering. More...
#include <Inventor/Win/SoWinGLWidget.h>
This abstract base class provides a C++ wrapper around an OpenGL drawing window. It allows OpenGL rendering to be performed within a Windows window and is used by the SoWinRenderArea. SoWinGLWidget uses a parent window with two separate OpenGL windows (one for single buffering 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 Windows messages.
SoWinComponent, SoWinRenderArea
virtual SbBool SoWinGLWidget::bindNormalContext | ( | ) | [virtual] |
Makes the normal rendering context the current context.
Equivalent to makeNormalCurrent() call.
SoSceneManager::AntialiasingMode SoWinGLWidget::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* SoWinGLWidget::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 SoWinGLWidget::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 SoWinGLWidget::getBorderSize | ( | ) | [inline] |
Included for portability only.
Cursor SoWinGLWidget::getCursor | ( | ) |
Returns the current cursor.
void SoWinGLWidget::getFloatingColorBuffer | ( | SbBool & | enable, | |
FloatColorBufferSize & | size | |||
) |
Returns TRUE if floating point rendering is used and its precision.
Reimplemented in SoWinRenderArea.
SoDEPRECATED SbBool SoWinGLWidget::getFullSceneAntialiasing | ( | float & | quality | ) |
Returns TRUE if FSAA is currently enabled.
Also returns the current quality value.
SoGLGraphicConfigTemplate* SoWinGLWidget::getGraphicConfigTemplate | ( | ) |
Gets the current graphics configuration template.
GLXContext SoWinGLWidget::getNormalContext | ( | ) | [inline] |
Gets the normal context, which is needed as an argument to SbGlContextHelper::makeCurrent() when drawing in the normal planes.
Note: This should not be cached by users because it will change as single/double buffering changes.
Hdc SoWinGLWidget::getNormalDC | ( | ) | const |
Returns the device context (which is needed for SbGlContextHelper::makeCurrent).
virtual SoGLContext* SoWinGLWidget::getNormalSoContext | ( | ) | [inline, virtual] |
XVisualInfo* SoWinGLWidget::getNormalVisual | ( | ) |
Returns the pixel format descriptor for the normal window.
SoWidget SoWinGLWidget::getNormalWidget | ( | ) | const |
Gets the normal window handle, which is needed as an argument to SbGlContextHelper::makeCurrent() when drawing in the normal planes.
Note: This should not be cached by users because it will change as single/double buffering changes.
virtual Window SoWinGLWidget::getNormalWindow | ( | ) | [virtual] |
Gets the normal GL window, which is needed as an argument to SbGlContextHelper::makeCurrent() when drawing in the normal planes.
Note: This should not be cached by users because it will change as single/double buffering changes.
SoDEPRECATED GLXContext SoWinGLWidget::getOverlayContext | ( | void | ) | [inline] |
Gets the overlay context, which is needed as an argument to SbGlContextHelper::makeCurrent() when drawing in the overlay planes.
Note1: This should not be cached by users because it will change as single/double buffering changes.
Note2: Overlay planes are supported only if the graphics board supports overlay planes.
SoDEPRECATED Hdc SoWinGLWidget::getOverlayDC | ( | ) | const |
Returns the overlay device context (which is needed for SbGlContextHelper::makeCurrent).
SoDEPRECATED SoGLContext* SoWinGLWidget::getOverlaySoContext | ( | ) | [inline] |
SoDEPRECATED XVisualInfo* SoWinGLWidget::getOverlayVisual | ( | ) |
Returns the pixel format descriptor for the overlay window.
SoDEPRECATED SoWidget SoWinGLWidget::getOverlayWidget | ( | ) | const |
Gets the overlay window handle, which is needed as an argument to SbGlContextHelper::makeCurrent() when drawing in the overlay planes.
Note1: This should not be cached by users because it will change as single/double buffering changes.
Note2: Overlay planes are supported only if the graphics board supports overlay planes.
SoDEPRECATED Window SoWinGLWidget::getOverlayWindow | ( | ) |
Gets the overlay GL window, which is needed as an argument to SbGlContextHelper::makeCurrent() when drawing in overlay planes.
Note1: This should not be cached by users because it will change as single/double buffering changes.
Note2: Overlay planes are supported only if the graphics board supports overlay planes.
int SoWinGLWidget::getPixelFormat | ( | ) |
Returns the current pixel format.
This method allow an application to query a pixel format that has extended attributes that can't be specified in a PFD struct.
SbBool SoWinGLWidget::isBorder | ( | ) | const [inline] |
Included for portability only.
SbBool SoWinGLWidget::isDoubleBuffer | ( | ) | [inline] |
Returns whether double buffering is on or off.
SbBool SoWinGLWidget::isDrawToFrontBufferEnable | ( | ) | const [inline] |
Returns whether drawing to the front buffer is enabled.
SoDEPRECATED SbBool SoWinGLWidget::isFsaaSupported | ( | ) |
SoDEPRECATED SbBool SoWinGLWidget::isFullSceneAntialiasingAvailable | ( | ) | const |
Returns TRUE if FSAA is supported by current pixel format.
SoDEPRECATED SbBool SoWinGLWidget::isFullSceneAntialiasingEnabled | ( | ) | const |
Returns TRUE, if full-scene antialiasing (FSAA) is enabled.
SoDEPRECATED SbBool SoWinGLWidget::isFullSceneAntialiasingHQAvailable | ( | ) | const |
Returns TRUE if high quality full-scene antialiasing (FSAA) is available.
This feature requires the GL_MULTISAMPLE_FILTER_HINT_NV extension.
SoDEPRECATED SbBool SoWinGLWidget::isFullSceneAntialiasingHQEnabled | ( | ) | const |
Returns TRUE if the high quality mode for full-scene antialiasing (FSAA) is enabled.
virtual SoDEPRECATED SbBool SoWinGLWidget::makeNormalCurrent | ( | ) | [virtual] |
Makes the normal rendering context the current context.
bool SoWinGLWidget::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 SoWinGLWidget::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 SoWinGLWidget::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 SoWinGLWidget::setBorder | ( | SbBool | onOrOff | ) |
Included for portability only.
void SoWinGLWidget::setCursor | ( | Cursor | newCursor | ) |
Sets the current cursor.
If you are using a viewer class, the viewer will automatically change the cursor depending on the viewer mode. These changes will override the cursor set with this method unless you also call SoWinViewer::setCursorEnabled(FALSE).
void SoWinGLWidget::setDoubleBuffer | ( | SbBool | onOrOff | ) |
Routine that dynamically changes between single and double buffering.
Default is double buffer off. (The SoWinRenderArea subclass makes it double buffer by default.)
Reimplemented in SoWinViewer.
void SoWinGLWidget::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: FALSE.
void SoWinGLWidget::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.
Reimplemented in SoWinRenderArea.
SoDEPRECATED SbBool SoWinGLWidget::setFullSceneAntialiasing | ( | SbBool | enable, | |
float | quality = -1.0 , |
|||
int | filterMask = SoFullSceneAntialiasing::ALL | |||
) |
Enables or disables full-scene antialiasing (FSAA).
Returns TRUE on success.
FSAA is supported via the ARB_multisample OpenGL extension. The ARB_pixel_format OpenGL extension is also required to support this feature. Note: Use the SoFullSceneAntialiasing node to control FSAA during render traversal.
enable | Enables or disables FSAA rendering. | |
quality | Specifies the level of quality of the antialiasing rendering. The number of samples used in the antialiasing computation depends on your graphics hardware and on your video driver. NVidia graphics hardware can support number of samples * 2 levels of quality (assuming the NV_multisample_filter_hint OpenGL extension is available). The quality value is in the [0..1] interval. 0 is the lowest quality level and 1 is the highest quality level. When set to -1.0 the quality value is the default value for the pixel format. | |
filterMask | Specifies the types of shapes that should be antialiased (See SoFullSceneAntialiasing for more info.) |
Enables or disables the high quality mode for full-scene antialiasing (FSAA).
This feature requires the GL_MULTISAMPLE_FILTER_HINT_NV extension.
void SoWinGLWidget::setGraphicConfigTemplate | ( | SoGLGraphicConfigTemplate * | gTemplate | ) |
Sets a new graphics configuration template.
virtual void SoWinGLWidget::setNormalVisual | ( | XVisualInfo * | vis | ) | [virtual] |
Specifies the exact pixel format descriptor for the normal window.
This allows the user to create all possible pixel format descriptors supported by OpenGL. The PIXELFORMATDESCRIPTOR structure should be a valid OpenGL pixel format descriptor returned by ChoosePixelFormat(). (The methods for setting the pixel format descriptor are virtual so that derived classes can know when the pixel format descriptor is changing.)
Reimplemented in SoWinViewer.
virtual SoDEPRECATED void SoWinGLWidget::setOverlayVisual | ( | XVisualInfo * | vis | ) | [virtual] |
Specifies the exact pixel format descriptor for the overlay window.
This allows the user to create all possible pixel format descriptors supported by OpenGL. The PIXELFORMATDESCRIPTOR structure should be a valid OpenGL pixel format descriptor returned by ChoosePixelFormat(). (The methods for setting the pixel format descriptor are virtual so that derived classes can know when the pixel format descriptor is changing.)
Note: Overlay planes are supported only if the graphics board supports overlay planes.
virtual void SoWinGLWidget::setPixelFormat | ( | int | format | ) | [virtual] |
Sets the current pixel format.
This method allows an application to set a pixel format that has extended attributes that can't be specified in a PFD struct. The specified format must support OpenGL and drawing to a window. There are not separate methods for normal and overlay windows because the overlay is not a separate window on Win32 computers.
You can also use environment variable OIV_FORCE_PIXEL_FORMAT to request a pixel format.
Note: OIV_FORCE_PIXEL_FORMAT can also be used to set special convenience values (-1, -2, etc.) used for troubleshooting. However, these values are not actually valid pixel formats and are not supported by setPixelFormat.
void SoWinGLWidget::setStealFocus | ( | SbBool | onOrOff | ) | [inline] |
By default the GLWidget "steals" focus whenever the cursor moves over it.
This roughly simulates the UNIX/X "focusFollowsCursor" behavior (which has no equivalent in Win32) and allows the Ctrl and Shift keys to be detected for 1-button mouse behaviors. Sometimes you want to this off however, like when you're typing in the zoom field.
virtual SbBool SoWinGLWidget::swapNormalBuffers | ( | ) | [virtual] |
Swaps the normal front and back buffers.
SoDEPRECATED SbBool SoWinGLWidget::swapOverlayBuffers | ( | ) |
Swaps the overlay front and back buffers.
virtual SbBool SoWinGLWidget::unbindNormalContext | ( | ) | [virtual] |
unbind the current context (previously bind with bindNormalContext );