OpenSceneGraph
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
osg::DisplaySettings Class Reference

DisplaySettings class for encapsulating what visuals are required and have been set up, and the status of stereo viewing. More...

Inheritance diagram for osg::DisplaySettings:
Inheritance graph
[legend]
Collaboration diagram for osg::DisplaySettings:
Collaboration graph
[legend]

Public Types

enum  DisplayType { MONITOR, POWERWALL, REALITY_CENTER, HEAD_MOUNTED_DISPLAY }
 
enum  StereoMode {
  QUAD_BUFFER, ANAGLYPHIC, HORIZONTAL_SPLIT, VERTICAL_SPLIT,
  LEFT_EYE, RIGHT_EYE, HORIZONTAL_INTERLACE, VERTICAL_INTERLACE,
  CHECKERBOARD
}
 
enum  SplitStereoHorizontalEyeMapping { LEFT_EYE_LEFT_VIEWPORT, LEFT_EYE_RIGHT_VIEWPORT }
 
enum  SplitStereoVerticalEyeMapping { LEFT_EYE_TOP_VIEWPORT, LEFT_EYE_BOTTOM_VIEWPORT }
 
enum  ImplicitBufferAttachment { IMPLICIT_DEPTH_BUFFER_ATTACHMENT = (1 << 0), IMPLICIT_STENCIL_BUFFER_ATTACHMENT = (1 << 1), IMPLICIT_COLOR_BUFFER_ATTACHMENT = (1 << 2), DEFAULT_IMPLICIT_BUFFER_ATTACHMENT = IMPLICIT_COLOR_BUFFER_ATTACHMENT | IMPLICIT_DEPTH_BUFFER_ATTACHMENT }
 Methods used to set and get defaults for Cameras implicit buffer attachments. More...
 
enum  SwapMethod { SWAP_DEFAULT, SWAP_EXCHANGE, SWAP_COPY, SWAP_UNDEFINED }
 
enum  OSXMenubarBehavior { MENUBAR_AUTO_HIDE, MENUBAR_FORCE_HIDE, MENUBAR_FORCE_SHOW }
 
typedef int ImplicitBufferAttachmentMask
 
typedef std::vector< std::string > FileNames
 
typedef std::vector< osg::ref_ptr< osg::Object > > Objects
 

Public Member Functions

 DisplaySettings (ArgumentParser &arguments)
 
 DisplaySettings (const DisplaySettings &vs)
 
DisplaySettingsoperator= (const DisplaySettings &vs)
 
void setDisplaySettings (const DisplaySettings &vs)
 
void merge (const DisplaySettings &vs)
 
void setDefaults ()
 
void readEnvironmentalVariables ()
 read the environmental variables. More...
 
void readCommandLine (ArgumentParser &arguments)
 read the commandline arguments. More...
 
void setDisplayType (DisplayType type)
 
DisplayType getDisplayType () const
 
void setStereo (bool on)
 
bool getStereo () const
 
void setStereoMode (StereoMode mode)
 
StereoMode getStereoMode () const
 
void setEyeSeparation (float eyeSeparation)
 
float getEyeSeparation () const
 
void setSplitStereoHorizontalEyeMapping (SplitStereoHorizontalEyeMapping m)
 
SplitStereoHorizontalEyeMapping getSplitStereoHorizontalEyeMapping () const
 
void setSplitStereoHorizontalSeparation (int s)
 
int getSplitStereoHorizontalSeparation () const
 
void setSplitStereoVerticalEyeMapping (SplitStereoVerticalEyeMapping m)
 
SplitStereoVerticalEyeMapping getSplitStereoVerticalEyeMapping () const
 
void setSplitStereoVerticalSeparation (int s)
 
int getSplitStereoVerticalSeparation () const
 
void setSplitStereoAutoAdjustAspectRatio (bool flag)
 
bool getSplitStereoAutoAdjustAspectRatio () const
 
void setScreenWidth (float width)
 
float getScreenWidth () const
 
void setScreenHeight (float height)
 
float getScreenHeight () const
 
void setScreenDistance (float distance)
 
float getScreenDistance () const
 
void setDoubleBuffer (bool flag)
 
bool getDoubleBuffer () const
 
void setRGB (bool flag)
 
bool getRGB () const
 
void setDepthBuffer (bool flag)
 
bool getDepthBuffer () const
 
void setMinimumNumAlphaBits (unsigned int bits)
 
unsigned int getMinimumNumAlphaBits () const
 
bool getAlphaBuffer () const
 
void setMinimumNumStencilBits (unsigned int bits)
 
unsigned int getMinimumNumStencilBits () const
 
bool getStencilBuffer () const
 
void setMinimumNumAccumBits (unsigned int red, unsigned int green, unsigned int blue, unsigned int alpha)
 
unsigned int getMinimumNumAccumRedBits () const
 
unsigned int getMinimumNumAccumGreenBits () const
 
unsigned int getMinimumNumAccumBlueBits () const
 
unsigned int getMinimumNumAccumAlphaBits () const
 
bool getAccumBuffer () const
 
void setMaxNumberOfGraphicsContexts (unsigned int num)
 
unsigned int getMaxNumberOfGraphicsContexts () const
 
void setNumMultiSamples (unsigned int samples)
 
unsigned int getNumMultiSamples () const
 
bool getMultiSamples () const
 
void setCompileContextsHint (bool useCompileContexts)
 
bool getCompileContextsHint () const
 
void setSerializeDrawDispatch (bool serializeDrawDispatch)
 
bool getSerializeDrawDispatch () const
 
void setUseSceneViewForStereoHint (bool hint)
 
bool getUseSceneViewForStereoHint () const
 
void setNumOfDatabaseThreadsHint (unsigned int numThreads)
 Set the hint for the total number of threads in the DatbasePager set up, inclusive of the number of http dedicated threads. More...
 
unsigned int getNumOfDatabaseThreadsHint () const
 Get the hint for total number of threads in the DatbasePager set up, inclusive of the number of http dedicated threads. More...
 
void setNumOfHttpDatabaseThreadsHint (unsigned int numThreads)
 Set the hint for number of threads in the DatbasePager to dedicate to reading http requests. More...
 
unsigned int getNumOfHttpDatabaseThreadsHint () const
 Get the hint for number of threads in the DatbasePager dedicated to reading http requests. More...
 
void setApplication (const std::string &application)
 
const std::string & getApplication ()
 
void setMaxTexturePoolSize (unsigned int size)
 
unsigned int getMaxTexturePoolSize () const
 
void setMaxBufferObjectPoolSize (unsigned int size)
 
unsigned int getMaxBufferObjectPoolSize () const
 
void setImplicitBufferAttachmentMask (ImplicitBufferAttachmentMask renderMask=DisplaySettings::DEFAULT_IMPLICIT_BUFFER_ATTACHMENT, ImplicitBufferAttachmentMask resolveMask=DisplaySettings::DEFAULT_IMPLICIT_BUFFER_ATTACHMENT)
 
void setImplicitBufferAttachmentRenderMask (ImplicitBufferAttachmentMask implicitBufferAttachmentRenderMask)
 
void setImplicitBufferAttachmentResolveMask (ImplicitBufferAttachmentMask implicitBufferAttachmentResolveMask)
 
ImplicitBufferAttachmentMask getImplicitBufferAttachmentRenderMask () const
 Get mask selecting default implicit buffer attachments for Cameras primary FBOs. More...
 
ImplicitBufferAttachmentMask getImplicitBufferAttachmentResolveMask () const
 Get mask selecting default implicit buffer attachments for Cameras secondary MULTISAMPLE FBOs. More...
 
void setSwapMethod (SwapMethod swapMethod)
 Select preferred swap method.
 
SwapMethod getSwapMethod (void)
 Get preferred swap method.
 
void setSyncSwapBuffers (unsigned int numFrames=0)
 Set whether Arb Sync should be used to manage the swaps buffers, 0 disables the use of the sync, greater than zero enables sync based on number of frames specified. More...
 
unsigned int getSyncSwapBuffers () const
 Set whether Arb Sync should be used to manage the swaps buffers. More...
 
void setGLContextVersion (const std::string &version)
 Set the hint of which OpenGL version to attempt to create a graphics context for. More...
 
const std::string getGLContextVersion () const
 Get the hint of which OpenGL version to attempt to create a graphics context for. More...
 
void setGLContextFlags (unsigned int flags)
 Set the hint of the flags to use in when creating graphic contexts. More...
 
unsigned int getGLContextFlags () const
 Get the hint of the flags to use in when creating graphic contexts. More...
 
void setGLContextProfileMask (unsigned int mask)
 Set the hint of the profile mask to use in when creating graphic contexts. More...
 
unsigned int getGLContextProfileMask () const
 Get the hint of the profile mask to use in when creating graphic contexts. More...
 
void setNvOptimusEnablement (int value)
 Set the NvOptimusEnablement value. More...
 
int getNvOptimusEnablement () const
 Get the NvOptimusEnablement value. More...
 
void setKeystoneHint (bool enabled)
 
bool getKeystoneHint () const
 
void setKeystoneFileNames (const FileNames &filenames)
 
FileNames & getKeystoneFileNames ()
 
const FileNames & getKeystoneFileNames () const
 
void setKeystones (const Objects &objects)
 
Objects & getKeystones ()
 
const Objects & getKeystones () const
 
OSXMenubarBehavior getOSXMenubarBehavior () const
 
void setOSXMenubarBehavior (OSXMenubarBehavior hint)
 
virtual osg::Matrixd computeLeftEyeProjectionImplementation (const osg::Matrixd &projection) const
 helper function for computing the left eye projection matrix. More...
 
virtual osg::Matrixd computeLeftEyeViewImplementation (const osg::Matrixd &view, double eyeSeperationScale=1.0) const
 helper function for computing the left eye view matrix. More...
 
virtual osg::Matrixd computeRightEyeProjectionImplementation (const osg::Matrixd &projection) const
 helper function for computing the right eye view matrix. More...
 
virtual osg::Matrixd computeRightEyeViewImplementation (const osg::Matrixd &view, double eyeSeperationScale=1.0) const
 helper function for computing the right eye view matrix. More...
 
- Public Member Functions inherited from osg::Referenced
 Referenced (bool threadSafeRefUnref)
 
 Referenced (const Referenced &)
 
Referencedoperator= (const Referenced &)
 
virtual void setThreadSafeRefUnref (bool threadSafe)
 Set whether to use a mutex to ensure ref() and unref() are thread safe. More...
 
bool getThreadSafeRefUnref () const
 Get whether a mutex is used to ensure ref() and unref() are thread safe. More...
 
bool getThreadSafeRefUnref () const
 
OpenThreads::MutexgetRefMutex () const
 Get the mutex used to ensure thread safety of ref()/unref(). More...
 
OpenThreads::MutexgetRefMutex () const
 
int ref () const
 Increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
int unref () const
 Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it. More...
 
int unref_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it. More...
 
int referenceCount () const
 Return the number of pointers currently referencing this object. More...
 
ObserverSetgetObserverSet () const
 Get the ObserverSet if one is attached, otherwise return NULL. More...
 
ObserverSetgetOrCreateObserverSet () const
 Get the ObserverSet if one is attached, otherwise create an ObserverSet, attach it, then return this newly created ObserverSet. More...
 
void addObserver (Observer *observer) const
 Add a Observer that is observing this object, notify the Observer when this object gets deleted. More...
 
void removeObserver (Observer *observer) const
 Remove Observer that is observing this object. More...
 

Static Public Member Functions

static ref_ptr< DisplaySettings > & instance ()
 Maintain a DisplaySettings singleton for objects to query at runtime. More...
 
- Static Public Member Functions inherited from osg::Referenced
static OpenThreads::MutexgetGlobalReferencedMutex ()
 Get the optional global Referenced mutex, this can be shared between all osg::Referenced. More...
 
static void setThreadSafeReferenceCounting (bool enableThreadSafeReferenceCounting)
 Set whether reference counting should use a mutex for thread safe reference counting. More...
 
static bool getThreadSafeReferenceCounting ()
 Get whether reference counting is active. More...
 
static void setDeleteHandler (DeleteHandler *handler)
 Set a DeleteHandler to which deletion of all referenced counted objects will be delegated. More...
 
static DeleteHandlergetDeleteHandler ()
 Get a DeleteHandler. More...
 

Protected Attributes

DisplayType _displayType
 
bool _stereo
 
StereoMode _stereoMode
 
float _eyeSeparation
 
float _screenWidth
 
float _screenHeight
 
float _screenDistance
 
SplitStereoHorizontalEyeMapping _splitStereoHorizontalEyeMapping
 
int _splitStereoHorizontalSeparation
 
SplitStereoVerticalEyeMapping _splitStereoVerticalEyeMapping
 
int _splitStereoVerticalSeparation
 
bool _splitStereoAutoAdjustAspectRatio
 
bool _doubleBuffer
 
bool _RGB
 
bool _depthBuffer
 
unsigned int _minimumNumberAlphaBits
 
unsigned int _minimumNumberStencilBits
 
unsigned int _minimumNumberAccumRedBits
 
unsigned int _minimumNumberAccumGreenBits
 
unsigned int _minimumNumberAccumBlueBits
 
unsigned int _minimumNumberAccumAlphaBits
 
unsigned int _maxNumOfGraphicsContexts
 
unsigned int _numMultiSamples
 
bool _compileContextsHint
 
bool _serializeDrawDispatch
 
bool _useSceneViewForStereoHint
 
unsigned int _numDatabaseThreadsHint
 
unsigned int _numHttpDatabaseThreadsHint
 
std::string _application
 
unsigned int _maxTexturePoolSize
 
unsigned int _maxBufferObjectPoolSize
 
ImplicitBufferAttachmentMask _implicitBufferAttachmentRenderMask
 
ImplicitBufferAttachmentMask _implicitBufferAttachmentResolveMask
 
std::string _glContextVersion
 
unsigned int _glContextFlags
 
unsigned int _glContextProfileMask
 
SwapMethod _swapMethod
 
unsigned int _syncSwapBuffers
 
bool _keystoneHint
 
FileNames _keystoneFileNames
 
Objects _keystones
 
OSXMenubarBehavior _OSXMenubarBehavior
 
- Protected Attributes inherited from osg::Referenced
OpenThreads::AtomicPtr _observerSet
 
OpenThreads::Atomic _refCount
 
OpenThreads::Mutex_refMutex
 
int _refCount
 
void * _observerSet
 

Additional Inherited Members

- Protected Member Functions inherited from osg::Referenced
void signalObserversAndDelete (bool signalDelete, bool doDelete) const
 
void deleteUsingDeleteHandler () const
 

Detailed Description

DisplaySettings class for encapsulating what visuals are required and have been set up, and the status of stereo viewing.

Member Enumeration Documentation

◆ ImplicitBufferAttachment

Methods used to set and get defaults for Cameras implicit buffer attachments.

For more info: See description of Camera::setImplicitBufferAttachment method

DisplaySettings implicit buffer attachment selection defaults to: DEPTH and COLOR for both primary (Render) FBO and secondary Multisample (Resolve) FBO ie: IMPLICIT_DEPTH_BUFFER_ATTACHMENT | IMPLICIT_COLOR_BUFFER_ATTACHMENT

Member Function Documentation

◆ computeLeftEyeProjectionImplementation()

virtual osg::Matrixd osg::DisplaySettings::computeLeftEyeProjectionImplementation ( const osg::Matrixd projection) const
virtual

helper function for computing the left eye projection matrix.

◆ computeLeftEyeViewImplementation()

virtual osg::Matrixd osg::DisplaySettings::computeLeftEyeViewImplementation ( const osg::Matrixd view,
double  eyeSeperationScale = 1.0 
) const
virtual

helper function for computing the left eye view matrix.

◆ computeRightEyeProjectionImplementation()

virtual osg::Matrixd osg::DisplaySettings::computeRightEyeProjectionImplementation ( const osg::Matrixd projection) const
virtual

helper function for computing the right eye view matrix.

◆ computeRightEyeViewImplementation()

virtual osg::Matrixd osg::DisplaySettings::computeRightEyeViewImplementation ( const osg::Matrixd view,
double  eyeSeperationScale = 1.0 
) const
virtual

helper function for computing the right eye view matrix.

◆ getGLContextFlags()

unsigned int osg::DisplaySettings::getGLContextFlags ( ) const
inline

Get the hint of the flags to use in when creating graphic contexts.

◆ getGLContextProfileMask()

unsigned int osg::DisplaySettings::getGLContextProfileMask ( ) const
inline

Get the hint of the profile mask to use in when creating graphic contexts.

◆ getGLContextVersion()

const std::string osg::DisplaySettings::getGLContextVersion ( ) const
inline

Get the hint of which OpenGL version to attempt to create a graphics context for.

◆ getImplicitBufferAttachmentRenderMask()

ImplicitBufferAttachmentMask osg::DisplaySettings::getImplicitBufferAttachmentRenderMask ( ) const
inline

Get mask selecting default implicit buffer attachments for Cameras primary FBOs.

◆ getImplicitBufferAttachmentResolveMask()

ImplicitBufferAttachmentMask osg::DisplaySettings::getImplicitBufferAttachmentResolveMask ( ) const
inline

Get mask selecting default implicit buffer attachments for Cameras secondary MULTISAMPLE FBOs.

◆ getNumOfDatabaseThreadsHint()

unsigned int osg::DisplaySettings::getNumOfDatabaseThreadsHint ( ) const
inline

Get the hint for total number of threads in the DatbasePager set up, inclusive of the number of http dedicated threads.

◆ getNumOfHttpDatabaseThreadsHint()

unsigned int osg::DisplaySettings::getNumOfHttpDatabaseThreadsHint ( ) const
inline

Get the hint for number of threads in the DatbasePager dedicated to reading http requests.

◆ getNvOptimusEnablement()

int osg::DisplaySettings::getNvOptimusEnablement ( ) const

Get the NvOptimusEnablement value.

◆ getSyncSwapBuffers()

unsigned int osg::DisplaySettings::getSyncSwapBuffers ( ) const
inline

Set whether Arb Sync should be used to manage the swaps buffers.

◆ instance()

static ref_ptr<DisplaySettings>& osg::DisplaySettings::instance ( )
static

Maintain a DisplaySettings singleton for objects to query at runtime.

◆ readCommandLine()

void osg::DisplaySettings::readCommandLine ( ArgumentParser arguments)

read the commandline arguments.

◆ readEnvironmentalVariables()

void osg::DisplaySettings::readEnvironmentalVariables ( )

read the environmental variables.

◆ setGLContextFlags()

void osg::DisplaySettings::setGLContextFlags ( unsigned int  flags)
inline

Set the hint of the flags to use in when creating graphic contexts.

◆ setGLContextProfileMask()

void osg::DisplaySettings::setGLContextProfileMask ( unsigned int  mask)
inline

Set the hint of the profile mask to use in when creating graphic contexts.

◆ setGLContextVersion()

void osg::DisplaySettings::setGLContextVersion ( const std::string &  version)
inline

Set the hint of which OpenGL version to attempt to create a graphics context for.

◆ setNumOfDatabaseThreadsHint()

void osg::DisplaySettings::setNumOfDatabaseThreadsHint ( unsigned int  numThreads)
inline

Set the hint for the total number of threads in the DatbasePager set up, inclusive of the number of http dedicated threads.

◆ setNumOfHttpDatabaseThreadsHint()

void osg::DisplaySettings::setNumOfHttpDatabaseThreadsHint ( unsigned int  numThreads)
inline

Set the hint for number of threads in the DatbasePager to dedicate to reading http requests.

◆ setNvOptimusEnablement()

void osg::DisplaySettings::setNvOptimusEnablement ( int  value)

Set the NvOptimusEnablement value.

Default can be set using OSG_NvOptimusEnablement env var.

◆ setSyncSwapBuffers()

void osg::DisplaySettings::setSyncSwapBuffers ( unsigned int  numFrames = 0)
inline

Set whether Arb Sync should be used to manage the swaps buffers, 0 disables the use of the sync, greater than zero enables sync based on number of frames specified.


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