VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions
makVrv::DtGlVaoManager Class Reference

This class is used to manage an opengl vertex array object (VAO) dealing with multiple opengl contexts. More...

Public Member Functions

 DtGlVaoManager (makVrv::DtDe &de)
 CTOR. More...
 
virtual ~DtGlVaoManager ()
 DTOR. More...
 
virtual GLuint getOrCreateVao (osg::State *state, bool &created) const
 Gets or creates a vertex array object (VAO) and returns the handle to it. More...
 
virtual void clearVao (osg::GraphicsContext *graphicsContext) const
 Clears the VAO from graphics context mapping and queues it to be deleted. More...
 
virtual void deleteQueuedVaos (osg::GraphicsContext *graphicsContext) const
 Removes the VAO for a specific graphics context. More...
 

Protected Types

typedef std::map
< osg::observer_ptr< const
osg::GraphicsContext >, GLuint
MapContextToVao
 Mutables below. More...
 
typedef std::vector< GLuintVaoArray
 
typedef std::map
< osg::observer_ptr< const
osg::GraphicsContext >
, VaoArray
MapContextsToVaoArray
 

Protected Member Functions

virtual void deleteQueuedVaosInAllGc (osg::GraphicsContext *graphicsContext) const
 Removes the VAO for all contexts. More...
 
virtual void slot_windowToBeDestroyed (DtWindow *window)
 Handles window closing (context destroyed). More...
 

Protected Attributes

DtDemyDe
 
DtSignalConnectionManager myConnections
 
MapContextToVao myMutableGraphicsContextToVao
 
MapContextsToVaoArray myMutableGraphicsContextToVaoArrayToDelete
 Keep track of what vertex array objects (VAOs) we have seen per context so that we can delete the Vaos in the right context. More...
 

Private Member Functions

 DtGlVaoManager ()
 Default Constructor not implemented - not allowed. More...
 
 DtGlVaoManager (const DtGlVaoManager &other)
 Copy Constructor not implemented - Copy not allowed. More...
 
DtGlVaoManageroperator= (const DtGlVaoManager &other)
 Assignment Operator not implemented - Assignment not allowed. More...
 

Detailed Description

This class is used to manage an opengl vertex array object (VAO) dealing with multiple opengl contexts.

background: VAO's cannot be shared between OpenGL contexts. This class helps manage that situation by creating and tracking VAO handles for each unique context.

Basically, the user should call getOrCreateVao with a graphics context active (typically during draw) to get a handle for a VAO for that specific graphics context. getOrCreateVao will indicate if a new context was encountered and at that time the user should bind buffers associated with the VAO. When the VAO is not longer needed (for example, during shutdown), clearVao(0), and deleteQueuedVaos(0) should be called. These are also called in the destructor of this class so no need to call if destorying this manager.

Methods clearVao, deleteQueuedVaos can also be called for a specific graphics context to just modify that context.

Member Typedef Documentation

typedef std::map<osg::observer_ptr<const osg::GraphicsContext>, GLuint> makVrv::DtGlVaoManager::MapContextToVao
protected

Mutables below.

These are mutable due to the fact that osg has drawImplementation as const These mutables are protected instead of private so they can be used by any future derived classes.

typedef std::vector<GLuint> makVrv::DtGlVaoManager::VaoArray
protected
typedef std::map<osg::observer_ptr<const osg::GraphicsContext>, VaoArray > makVrv::DtGlVaoManager::MapContextsToVaoArray
protected

Constructor & Destructor Documentation

makVrv::DtGlVaoManager::DtGlVaoManager ( makVrv::DtDe de)

CTOR.

virtual makVrv::DtGlVaoManager::~DtGlVaoManager ( )
virtual

DTOR.

makVrv::DtGlVaoManager::DtGlVaoManager ( )
private

Default Constructor not implemented - not allowed.

makVrv::DtGlVaoManager::DtGlVaoManager ( const DtGlVaoManager other)
private

Copy Constructor not implemented - Copy not allowed.

Member Function Documentation

DtGlVaoManager& makVrv::DtGlVaoManager::operator= ( const DtGlVaoManager other)
private

Assignment Operator not implemented - Assignment not allowed.

virtual GLuint makVrv::DtGlVaoManager::getOrCreateVao ( osg::State *  state,
bool created 
) const
virtual

Gets or creates a vertex array object (VAO) and returns the handle to it.

Parameters
stateThe state object that contains the graphics context.
createdThis value is set to true if the VAO is newly created.
virtual void makVrv::DtGlVaoManager::clearVao ( osg::GraphicsContext *  graphicsContext) const
virtual

Clears the VAO from graphics context mapping and queues it to be deleted.

If state is NULL(0), then VAO is cleared from all contexts.

Parameters
graphicsContextThe graphics context.
virtual void makVrv::DtGlVaoManager::deleteQueuedVaos ( osg::GraphicsContext *  graphicsContext) const
virtual

Removes the VAO for a specific graphics context.

Assumes the graphics context is active. If graphicsContext is NULL(0), then VAO is removed from all contexts.

Parameters
graphicsContextThe graphics context.
virtual void makVrv::DtGlVaoManager::deleteQueuedVaosInAllGc ( osg::GraphicsContext *  graphicsContext) const
protectedvirtual

Removes the VAO for all contexts.

This should be called when destructing or releasing OpenGL resources. For non-active contexts, the VAO's are handed off to a DtGLDeleteObjectManager to be deleted when appropriate.

Parameters
graphicsContextThe graphics context.
virtual void makVrv::DtGlVaoManager::slot_windowToBeDestroyed ( DtWindow window)
protectedvirtual

Handles window closing (context destroyed).

Member Data Documentation

DtDe& makVrv::DtGlVaoManager::myDe
protected
DtSignalConnectionManager makVrv::DtGlVaoManager::myConnections
protected
MapContextToVao makVrv::DtGlVaoManager::myMutableGraphicsContextToVao
mutableprotected
MapContextsToVaoArray makVrv::DtGlVaoManager::myMutableGraphicsContextToVaoArrayToDelete
mutableprotected

Keep track of what vertex array objects (VAOs) we have seen per context so that we can delete the Vaos in the right context.


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

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)