Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoStereoViewer Class Referenceabstract

VSG extension Pure virtual class for stereo support. More...

#include <Inventor/components/stereo/SoStereoViewer.h>

+ Inheritance diagram for SoStereoViewer:

Public Member Functions

virtual ~SoStereoViewer ()
 Destructor.
 
virtual void setStereoActive (SbBool activate)=0
 Sets stereo activation.
 
virtual SbBool isStereoActive ()=0
 Queries stereo activation.
 
virtual void actualRendering ()=0
 This method is called automatically when the viewer requests that its SoBaseStereo object perform stereo rendering.
 
virtual SoCameragetViewerCamera ()=0
 Returning the camera allows the SoBaseStereo to manipulate it to achieve the stereo effect.
 
virtual const SbVec2sgetSize ()=0
 Returns the size of the OpenGL drawing window in absolute screen coordinates (not relative to parent window) of the native window system.
 
virtual const SbVec2sgetTopLeft ()=0
 Returns the position of the OpenGL drawing window in absolute screen coordinates (not relative to parent window) of the native window system (typically Y increasing downward).
 
virtual const SbVec2sgetBottomRight ()=0
 Returns the position of the OpenGL drawing window in absolute screen coordinates (not relative to parent window) of the native window system (typically Y increasing downward).
 
virtual SbBool isViewerDoubleBuffer ()=0
 Queries if viewer is double buffered.
 
virtual void setStereoViewType (SoBaseStereo *stereoViewType)=0
 If stereoViewType is NULL, the stereo is inactivated (see setStereoActive).
 
virtual SoBaseStereogetStereoViewType ()=0
 Returns the stereo view type.
 
virtual void reverseStereoView (SbBool reverse)=0
 Sets reversal of the left and right views.
 
virtual SbBool isStereoViewReversed ()=0
 Queries reversal of the left and right views.
 
virtual void setStereoAbsoluteAdjustments (SbBool)
 Specifies if stereo adjustments are absolute.
 
virtual SbBool isStereoAbsoluteAdjustments () const
 Queries if the stereo adjustments are absolute.
 
virtual void setStereoOffset (float offset)=0
 Sets the stereo offset (the distance of each eye from the camera position).
 
virtual float getStereoOffset ()=0
 Queries the stereo offset.
 
virtual void setStereoBalance (float balance, SbBool nearFrac=false)=0
 Sets the stereo balance (the position of the zero parallax plane) and specifies whether the balance value is defined as a fraction of the camera near distance.
 
virtual float getStereoBalance ()=0
 Queries the stereo balance (the position of the zero parallax plane).
 
virtual SbBool isStereoBalanceNearFrac ()=0
 Returns TRUE when the stereo balance adjustement is defined as a fraction of the camera near distance.
 
virtual void setViewport (short left, short bottom, short width, short height)=0
 Sets viewport region with given origin (lower-left corner) and size, given as pixel coordinates.
 
virtual void getViewport (short &left, short &bottom, short &width, short &height)=0
 Returns viewport region with origin (lower-left corner) and size, given as pixel coordinates.
 
virtual SoGLContextgetViewerContext ()=0
 Returns the current SoGLContext to render to.
 
virtual SoSceneManagergetViewerSceneManager ()=0
 Returns the current SoSceneManager to render to.
 

Detailed Description

VSG extension Pure virtual class for stereo support.

This pure virtual class is the class that should be extended by viewer classes that will do stereo rendering.

Note: because of internal dependant calls between stereo classes and Open Inventor viewer classes, SoStereoViewer and SoBaseStereo (and inheriting classes) cannot be used without using SoWinViewer/SoXtViewer/SoQtViewer inheriting classes.

SEE ALSO

SoWinViewer, SoXtViewer, SoQtViewer

Definition at line 55 of file SoStereoViewer.h.

Constructor & Destructor Documentation

◆ ~SoStereoViewer()

virtual SoStereoViewer::~SoStereoViewer ( )
inlinevirtual

Destructor.

Definition at line 63 of file SoStereoViewer.h.

Member Function Documentation

◆ actualRendering()

virtual void SoStereoViewer::actualRendering ( )
pure virtual

This method is called automatically when the viewer requests that its SoBaseStereo object perform stereo rendering.

actualRendering() may then be called twice (once for each eye view) and therefore must not take into account any stereo-specific settings. It should behave as if it were a rendering method for a monoscopic view.

Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.

◆ getBottomRight()

virtual const SbVec2s & SoStereoViewer::getBottomRight ( )
pure virtual

Returns the position of the OpenGL drawing window in absolute screen coordinates (not relative to parent window) of the native window system (typically Y increasing downward).

Returns "Bottom" in the first value of the vector and "Right" in the second value (reverse of the usual X,Y ordering).

Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.

◆ getSize()

virtual const SbVec2s & SoStereoViewer::getSize ( )
pure virtual

Returns the size of the OpenGL drawing window in absolute screen coordinates (not relative to parent window) of the native window system.

Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.

◆ getStereoBalance()

virtual float SoStereoViewer::getStereoBalance ( )
pure virtual

Queries the stereo balance (the position of the zero parallax plane).

Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.

◆ getStereoOffset()

virtual float SoStereoViewer::getStereoOffset ( )
pure virtual

Queries the stereo offset.

Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.

◆ getStereoViewType()

virtual SoBaseStereo * SoStereoViewer::getStereoViewType ( )
pure virtual

Returns the stereo view type.

Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.

◆ getTopLeft()

virtual const SbVec2s & SoStereoViewer::getTopLeft ( )
pure virtual

Returns the position of the OpenGL drawing window in absolute screen coordinates (not relative to parent window) of the native window system (typically Y increasing downward).

Returns "Top" in the first value of the vector and "Left" in the second value (reverse of the usual X,Y ordering).

Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.

◆ getViewerCamera()

virtual SoCamera * SoStereoViewer::getViewerCamera ( )
pure virtual

Returning the camera allows the SoBaseStereo to manipulate it to achieve the stereo effect.

Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.

◆ getViewerContext()

virtual SoGLContext * SoStereoViewer::getViewerContext ( )
pure virtual

Returns the current SoGLContext to render to.

Must return a valid SoGLContext instance.

◆ getViewerSceneManager()

virtual SoSceneManager * SoStereoViewer::getViewerSceneManager ( )
pure virtual

Returns the current SoSceneManager to render to.

Must return a valid SoSceneManager instance.

◆ getViewport()

virtual void SoStereoViewer::getViewport ( short &  left,
short &  bottom,
short &  width,
short &  height 
)
pure virtual

Returns viewport region with origin (lower-left corner) and size, given as pixel coordinates.

Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.

◆ isStereoAbsoluteAdjustments()

virtual SbBool SoStereoViewer::isStereoAbsoluteAdjustments ( ) const
inlinevirtual

Queries if the stereo adjustments are absolute.

Not virtual pure for compatibity reasons.

Reimplemented in SoQtViewer, SoWinViewer, and SoXtViewer.

Definition at line 189 of file SoStereoViewer.h.

◆ isStereoActive()

virtual SbBool SoStereoViewer::isStereoActive ( )
pure virtual

Queries stereo activation.

Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.

◆ isStereoBalanceNearFrac()

virtual SbBool SoStereoViewer::isStereoBalanceNearFrac ( )
pure virtual

Returns TRUE when the stereo balance adjustement is defined as a fraction of the camera near distance.

Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.

◆ isStereoViewReversed()

virtual SbBool SoStereoViewer::isStereoViewReversed ( )
pure virtual

Queries reversal of the left and right views.

Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.

◆ isViewerDoubleBuffer()

virtual SbBool SoStereoViewer::isViewerDoubleBuffer ( )
pure virtual

Queries if viewer is double buffered.

Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.

◆ reverseStereoView()

virtual void SoStereoViewer::reverseStereoView ( SbBool  reverse)
pure virtual

Sets reversal of the left and right views.

Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.

◆ setStereoAbsoluteAdjustments()

virtual void SoStereoViewer::setStereoAbsoluteAdjustments ( SbBool  )
inlinevirtual

Specifies if stereo adjustments are absolute.

FALSE by default.

The default non-absolute mode allows the stereo settings to be valid over a range of different view volume settings. If you chose absolute mode, you are responsible for modifying the stereo settings (if necessary) when the view volume changes.

When absolute mode is TRUE, stereo offset and balance are used as follows for the right eye view:

StereoCameraOffset = getStereoAdjustment();
FrustumAsymmetry = getBalanceAdjustment();
glTranslated (-StereoCameraOffset, 0, 0);
glFrustum (FrustumLeft + FrustumAsymmetry, FrustumRight + FrustumAsymmetry,
FrustumBottom, FrustumTop, NearClipDistance, FarClipDistance);

The left eye view is symmetric.

When absolute mode is FALSE, stereo offset and balance are used as follows for the right eye view:

Xrange is right minus left (i.e., first two arguments of glFrustum) and multiply that difference by the ratio of the distance to the desired plane of zero parallax to the near clipping plane distance.

StereoCameraOffset = Xrange * 0.035 * getStereoAdjustment();
FrustumAsymmetry = -StereoCameraOffset * getBalanceAdjustment();
ZeroParallaxDistance = (NearClipDistance + FarClipDistance)/0.5;
FrustumAsymmetry *= NearClipDistance / ZeroParallaxDistance;
glTranslated (-StereoCameraOffset, 0, 0);
glFrustum (FrustumLeft + FrustumAsymmetry, FrustumRight + FrustumAsymmetry,
FrustumBottom, FrustumTop, NearClipDistance, FarClipDistance);

The left eye view is symmetric.

Not virtual pure for compatiblity reasons.

Reimplemented in SoQtViewer, SoWinViewer, and SoXtViewer.

Definition at line 182 of file SoStereoViewer.h.

◆ setStereoActive()

virtual void SoStereoViewer::setStereoActive ( SbBool  activate)
pure virtual

Sets stereo activation.

Default is FALSE. The default can be set using the OIV_STEREO_ACTIVE environment variable.

Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.

◆ setStereoBalance()

virtual void SoStereoViewer::setStereoBalance ( float  balance,
SbBool  nearFrac = false 
)
pure virtual

Sets the stereo balance (the position of the zero parallax plane) and specifies whether the balance value is defined as a fraction of the camera near distance.

Note: Since the projection matrix always depends on the camera's near plane, in some cases it may be necessary to detect changes to the camera near plane and adjust by setting a new stereo balance value. Open Inventor will make these adjustments automatically if the nearFrac parameter is set to TRUE.
In this case the stereo balance value is defined as a fraction of the camera near distance.

Default balance is 1.0. The default can be set using the OIV_STEREO_BALANCE environment variable. Default nearFrac is FALSE. The default can be set using the OIV_STEREO_BALANCE_NEAR_FRAC environment variable.

Implemented in SoXtViewer, SoQtViewer, and SoWinViewer.

◆ setStereoOffset()

virtual void SoStereoViewer::setStereoOffset ( float  offset)
pure virtual

Sets the stereo offset (the distance of each eye from the camera position).

The right eye is moved plus offset and the left eye is moved minus offset. Default is 0.7. The default can be set using OIV_STEREO_OFFSET environment variable.

Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.

◆ setStereoViewType()

virtual void SoStereoViewer::setStereoViewType ( SoBaseStereo stereoViewType)
pure virtual

If stereoViewType is NULL, the stereo is inactivated (see setStereoActive).

Default is SoAnaglyphStereo with RED_CYAN color filter. The default can be set using the OIV_STEREO_TYPE environment variable.

Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.

◆ setViewport()

virtual void SoStereoViewer::setViewport ( short  left,
short  bottom,
short  width,
short  height 
)
pure virtual

Sets viewport region with given origin (lower-left corner) and size, given as pixel coordinates.

Implemented in SoQtViewer, SoWinViewer, and SoXtViewer.


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