Component for OpenGL rendering. More...
#include <Inventor/Qt/SoQtGLWidget.h>
Public Types | |
enum | FloatColorBufferSize { FLOAT_16_COLOR_BUFFER = SoGuiGLWidget::FLOAT_16_COLOR_BUFFER, FLOAT_32_COLOR_BUFFER = SoGuiGLWidget::FLOAT_32_COLOR_BUFFER } |
Public Member Functions | |
int | getColorMapSize () |
void | setColorMapSize (int size) |
virtual WindowQt | getNormalWindow () |
QOpenGLContext * | getQOpenGLContext () |
SoGLContext * | getNormalSoContext () |
QWidget * | getNormalWidget () |
QSurfaceFormat | getQSurfaceFormat () |
virtual void | setNormalVisual (QSurfaceFormat vis) |
virtual void | setNormalVisual (const SoGLFormat &format) |
virtual void | show () |
virtual void | hide () |
virtual void | setDoubleBuffer (SbBool onOrOff) |
SbBool | isDoubleBuffer () |
void | setBorder (SbBool onOrOff) |
int | getBorderSize () |
SbBool | isBorder () const |
void | setDrawToFrontBufferEnable (SbBool enableFlag) |
SbBool | isDrawToFrontBufferEnable () const |
virtual SbBool | bindNormalContext () |
virtual SbBool | unbindNormalContext () |
virtual SbBool | swapNormalBuffers () |
virtual void | setCursor (const QCursor &newCursor) |
QCursor | getCursor () const |
void | setAntialiasing (const float quality, const SoSceneManager::AntialiasingMode mode=SoSceneManager::AUTO) |
void | setAntialiasing (SoAntialiasingParameters *advancedParameters) |
float | getAntialiasingQuality () const |
SoSceneManager::AntialiasingMode | getAntialiasingMode () const |
SoAntialiasingParameters * | getAntialiasingParameters () const |
bool | saveSnapshot (const SbString &filename, bool overwrite=true) |
Friends | |
class | SoQGLWidgetProxy |
Deprecated | |
| |
SoDEPRECATED unsigned long | getOverlayTransparentPixel () |
SoDEPRECATED void | setOverlayTransparentPixel (unsigned long pixel) |
SoDEPRECATED int | getOverlayColorMapSize () |
SoDEPRECATED void | setOverlayColorMapSize (int size) |
SoDEPRECATED WindowQt | getOverlayWindow () |
SoDEPRECATED QGLContext * | getOverlayContext () |
SoDEPRECATED SoGLContext * | getOverlaySoContext () |
SoDEPRECATED QWidget * | getOverlayWidget () |
virtual SoDEPRECATED void | setOverlayVisual (QGLFormat *vis) |
virtual SoDEPRECATED void | setOverlayVisual (const SoGLFormat &format) |
SoDEPRECATED QGLFormat * | getOverlayVisual () |
SoDEPRECATED SbBool | makeOverlayCurrent () |
virtual SoDEPRECATED SbBool | bindOverlayContext () |
virtual SoDEPRECATED SbBool | unbindOverlayContext () |
SoDEPRECATED SbBool | swapOverlayBuffers () |
SoDEPRECATED QGLContext * | getNormalContext () |
SoDEPRECATED QGLFormat * | getNormalFormat () |
SoDEPRECATED QGLFormat * | getNormalVisual () |
virtual SoDEPRECATED void | setNormalVisual (QGLFormat *) |
SoDEPRECATED int | getFrameBufferObjectId () const |
virtual SoDEPRECATED void | setNormalVisual (SbGlContextHelper::VisualInfo vis) |
virtual SoDEPRECATED void | setOverlayVisual (SbGlContextHelper::VisualInfo vis) |
virtual SoDEPRECATED SbBool | makeNormalCurrent () |
SoDEPRECATED SbBool | isFsaaSupported () |
SoDEPRECATED SbBool | setFullSceneAntialiasing (SbBool enable, float quality=-1.0, int filterMask=SoFullSceneAntialiasing::ALL) |
SoDEPRECATED SbBool | isFullSceneAntialiasingEnabled () const |
SoDEPRECATED SbBool | getFullSceneAntialiasing (float &quality) |
SoDEPRECATED SbBool | isFullSceneAntialiasingAvailable () const |
SoDEPRECATED SbBool | isFullSceneAntialiasingHQAvailable () const |
SoDEPRECATED SbBool | setFullSceneAntialiasingHQ (SbBool enable) |
SoDEPRECATED SbBool | isFullSceneAntialiasingHQEnabled () const |
This abstract base class provides a C++ wrapper around an OpenGL widget. It allows OpenGL rendering to be performed within a widget and is used by the SoQtRenderArea. SoQtGLWidget uses a parent window with two separate OpenGL widgets (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 Q events.
virtual SbBool SoQtGLWidget::bindNormalContext | ( | ) | [virtual] |
Makes the normal rendering context the current context.
Equivalent to makeNormalCurrent() call.
virtual SoDEPRECATED SbBool SoQtGLWidget::bindOverlayContext | ( | ) | [virtual] |
Makes the overlay rendering context the current context.
Equivalent to makeOverlayCurrent() call.
SoSceneManager::AntialiasingMode SoQtGLWidget::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* SoQtGLWidget::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 SoQtGLWidget::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 SoQtGLWidget::getBorderSize | ( | ) | [inline] |
Included for portability only.
int SoQtGLWidget::getColorMapSize | ( | ) |
Returns the color map size.
QCursor SoQtGLWidget::getCursor | ( | ) | const |
Returns the current cursor.
SoDEPRECATED int SoQtGLWidget::getFrameBufferObjectId | ( | ) | const [inline] |
SoDEPRECATED SbBool SoQtGLWidget::getFullSceneAntialiasing | ( | float & | quality | ) |
Returns TRUE if FSAA is currently enabled.
Also returns the current quality value.
SoDEPRECATED QGLContext* SoQtGLWidget::getNormalContext | ( | ) | [inline] |
Gets the current normal context, which is needed as an argument to glXMakeCurrent() (on Xt) or SbGlContextHelper::makeCurrent() (on Windows) when drawing in the normal planes.
Note: This should not be cached by users because it will change as single/double buffering changes.
SoDEPRECATED QGLFormat* SoQtGLWidget::getNormalFormat | ( | ) | [inline] |
Returns the QGLFormat currently used.
SoGLContext* SoQtGLWidget::getNormalSoContext | ( | ) |
Gets the current context, which is needed as an argument to glXMakeCurrent() (on Xt) or SbGlContextHelper::makeCurrent() (on Windows) when drawing in the normal planes.
Note: This should not be cached by users because it will change as single/double buffering changes.
SoDEPRECATED QGLFormat* SoQtGLWidget::getNormalVisual | ( | ) | [inline] |
Returns the QGLFormat for the normal window.
QWidget* SoQtGLWidget::getNormalWidget | ( | ) |
Gets the current normal widget.
Since Open Inventor 8.0, this widget is a QGLWidget. More information about this class can be found on-line in the Qt documentation.
The actual class returned by this method is an instance of SoQGLWidgetProxy, which is an Open Inventor internal class derived from QGLWidget. The instance can be used as a QGLWidget, but note that Open Inventor manages OpenGL itself, so it does not implement the initializeGL, paintGL, etc methods.
Note: This should not be cached by users because it will change as single/double buffering changes.
virtual WindowQt SoQtGLWidget::getNormalWindow | ( | ) | [virtual] |
Gets the normal GL window (window system identifier of the widget), which is needed as an argument to glXMakeCurrent() (on Xt) or SbGlContextHelper::makeCurrent() (on Windows) when drawing in the normal planes.
Note: This should not be cached by users because it will change as single/double buffering changes.
SoDEPRECATED int SoQtGLWidget::getOverlayColorMapSize | ( | ) |
Returns the overlay color map size.
SoDEPRECATED QGLContext* SoQtGLWidget::getOverlayContext | ( | ) |
Gets the current overlay context, which is needed as an argument to glXMakeCurrent() when drawing in the overlay planes.
Note: This should not be cached by users because it will change as single/double buffering changes.
SoDEPRECATED SoGLContext* SoQtGLWidget::getOverlaySoContext | ( | ) |
SoDEPRECATED unsigned long SoQtGLWidget::getOverlayTransparentPixel | ( | ) |
Returns the overlay transparent pixel.
SoDEPRECATED QGLFormat* SoQtGLWidget::getOverlayVisual | ( | ) |
Returns the QGLFormat for the overlay window.
SoDEPRECATED QWidget* SoQtGLWidget::getOverlayWidget | ( | ) |
Gets the current overlay widget, which is needed as an argument to glXMakeCurrent() when drawing in the overlay planes.
Since Open Inventor 8.0, this widget is a QGLWidget. More information about this class can be found on-line in the Qt documentation.
Note: This should not be cached by users because it will change as single/double buffering changes.
SoDEPRECATED WindowQt SoQtGLWidget::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.
QOpenGLContext* SoQtGLWidget::getQOpenGLContext | ( | ) |
Gets the current context, which is needed as an argument to glXMakeCurrent() (on Xt) or SbGlContextHelper::makeCurrent() (on Windows) when drawing in the normal planes.
Note: This should not be cached by users because it will change as single/double buffering changes.
QSurfaceFormat SoQtGLWidget::getQSurfaceFormat | ( | ) |
Returns the QSurfaceFormat currently used.
virtual void SoQtGLWidget::hide | ( | ) | [virtual] |
SbBool SoQtGLWidget::isBorder | ( | ) | const [inline] |
Included for portability only.
SbBool SoQtGLWidget::isDoubleBuffer | ( | ) | [inline] |
Returns whether double buffering is on or off.
SbBool SoQtGLWidget::isDrawToFrontBufferEnable | ( | ) | const [inline] |
Queries drawing to the front buffer.
SoDEPRECATED SbBool SoQtGLWidget::isFsaaSupported | ( | ) |
Makes the normal rendering context the current context.
SoDEPRECATED SbBool SoQtGLWidget::isFullSceneAntialiasingAvailable | ( | ) | const |
Returns TRUE if FSAA is supported by current pixel format.
SoDEPRECATED SbBool SoQtGLWidget::isFullSceneAntialiasingEnabled | ( | ) | const |
Returns TRUE, if full-scene antialiasing (FSAA) is enabled.
SoDEPRECATED SbBool SoQtGLWidget::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 SoQtGLWidget::isFullSceneAntialiasingHQEnabled | ( | ) | const |
Returns TRUE if the high quality mode for full-scene antialiasing (FSAA) is enabled.
virtual SoDEPRECATED SbBool SoQtGLWidget::makeNormalCurrent | ( | ) | [virtual] |
Makes the normal rendering context the current context.
SoDEPRECATED SbBool SoQtGLWidget::makeOverlayCurrent | ( | ) |
Makes the overlay rendering context the current context.
bool SoQtGLWidget::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 SoQtGLWidget::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 SoQtGLWidget::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 SoQtGLWidget::setBorder | ( | SbBool | onOrOff | ) |
Included for portability only.
void SoQtGLWidget::setColorMapSize | ( | int | size | ) |
Sets the color map size.
virtual void SoQtGLWidget::setCursor | ( | const QCursor & | newCursor | ) | [virtual] |
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 SoQtGLWidget::setCursorEnabled(FALSE).
virtual void SoQtGLWidget::setDoubleBuffer | ( | SbBool | onOrOff | ) | [virtual] |
Routine that dynamically changes between single and double buffering.
Default is double buffer off. (The SoQtRenderArea subclass makes it double buffer by default.)
void SoQtGLWidget::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.
SoDEPRECATED SbBool SoQtGLWidget::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.
virtual SoDEPRECATED void SoQtGLWidget::setNormalVisual | ( | SbGlContextHelper::VisualInfo | vis | ) | [virtual] |
virtual SoDEPRECATED void SoQtGLWidget::setNormalVisual | ( | QGLFormat * | ) | [inline, virtual] |
Sets the visual/pixel format for the normal window.
This allows the user to create all possible visuals supported by OpenGL. The OpenGL drivers or accelerated hardware may or may not support advanced features such as alpha channel or stereographic viewing. If you request some features that the driver/hardware does not provide when you set the QGLFormat , you will get a rendering context with the nearest subset of features.
The methods for setting the visual are virtual so that derived classes can know when the visual is changing.
virtual void SoQtGLWidget::setNormalVisual | ( | const SoGLFormat & | format | ) | [virtual] |
Sets the visual/pixel format for the normal window.
This allows the user to create all possible visuals supported by OpenGL. The OpenGL drivers or accelerated hardware may or may not support advanced features such as alpha channel or stereographic viewing. If you request some features that the driver/hardware does not provide when you set the QGLFormat , you will get a rendering context with the nearest subset of features.
The methods for setting the visual are virtual so that derived classes can know when the visual is changing.
virtual void SoQtGLWidget::setNormalVisual | ( | QSurfaceFormat | vis | ) | [virtual] |
Sets the visual/pixel format for the normal window.
This allows the user to create all possible visuals supported by OpenGL. The OpenGL drivers or accelerated hardware may or may not support advanced features such as alpha channel or stereographic viewing. If you request some features that the driver/hardware does not provide when you set the QGLFormat , you will get a rendering context with the nearest subset of features.
The methods for setting the visual are virtual so that derived classes can know when the visual is changing.
SoDEPRECATED void SoQtGLWidget::setOverlayColorMapSize | ( | int | size | ) |
Sets the overlay color map size.
SoDEPRECATED void SoQtGLWidget::setOverlayTransparentPixel | ( | unsigned long | pixel | ) |
Sets the overlay transparent pixel.
virtual SoDEPRECATED void SoQtGLWidget::setOverlayVisual | ( | SbGlContextHelper::VisualInfo | vis | ) | [virtual] |
virtual SoDEPRECATED void SoQtGLWidget::setOverlayVisual | ( | const SoGLFormat & | format | ) | [virtual] |
virtual SoDEPRECATED void SoQtGLWidget::setOverlayVisual | ( | QGLFormat * | vis | ) | [virtual] |
Specify exactly what the visual should be for the overlay window.
This allows the user to create all possible visual supported by OpenGL. The XVisualInfo structure should be a valid OpenGL visual returned by glXChooseVisual (). This structure will be copied by the SoQtGLWidget; 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 void SoQtGLWidget::show | ( | ) | [virtual] |
This shows the component.
Reimplemented from SoQtComponent.
virtual SbBool SoQtGLWidget::swapNormalBuffers | ( | ) | [virtual] |
Swaps the normal front and back buffers.
SoDEPRECATED SbBool SoQtGLWidget::swapOverlayBuffers | ( | ) |
Swaps the overlay front and back buffers.
Equivalent to calling
virtual SbBool SoQtGLWidget::unbindNormalContext | ( | ) | [virtual] |
unbind the current context (previously bind with bindNormalContext );
virtual SoDEPRECATED SbBool SoQtGLWidget::unbindOverlayContext | ( | ) | [virtual] |
unbind the current context (previously bind with bindOverlayContext );
friend class SoQGLWidgetProxy [friend] |