![]() |
VR-Forces 5.0.3 Developer's Guide
|
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.
Public Member Functions | |
| DtGlVaoManager (makVrv::DtDe &de) | |
| virtual | ~DtGlVaoManager () |
| virtual DtGlVaoAndContext | getOrCreateVao (const osg::GraphicsContext *graphicsContext, bool &created) const |
| virtual void | clearVao (const osg::GraphicsContext *graphicsContext) const |
| virtual void | deleteQueuedVaos (const osg::GraphicsContext *graphicsContext) const |
Protected Types | |
| typedef std::map < osg::observer_ptr< const osg::GraphicsContext > , DtGlVaoAndContext > | MapContextToVao |
| typedef std::vector < DtGlVaoAndContext > | VaoArray |
| typedef std::map < osg::observer_ptr< const osg::GraphicsContext > , VaoArray > | MapContextsToVaoArray |
Protected Member Functions | |
| virtual void | deleteQueuedVaosInAllGc (osg::GraphicsContext *graphicsContext) const |
| virtual void | slot_windowToBeDestroyed (DtWindow *window) |
| virtual void | attemptToDeleteVao (const void *glContext, DtGlVaoAndContext &fbo) const |
Protected Attributes | |
| DtDe & | myDe |
| DtSignalConnectionManager | myConnections |
| MapContextToVao | myMutableGraphicsContextToVao |
| MapContextsToVaoArray | myMutableGraphicsContextToVaoArrayToDelete |
Private Member Functions | |
| DtGlVaoManager () | |
| DtGlVaoManager (const DtGlVaoManager &other) | |
| DtGlVaoManager & | operator= (const DtGlVaoManager &other) |
|
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.
|
protected |
|
protected |
| makVrv::DtGlVaoManager::DtGlVaoManager | ( | makVrv::DtDe & | de | ) |
CTOR.
|
virtual |
DTOR.
|
private |
Default Constructor not implemented - not allowed.
|
private |
Copy Constructor not implemented - Copy not allowed.
|
private |
Assignment Operator not implemented - Assignment not allowed.
|
virtual |
Gets or creates a vertex array object (VAO) and returns the handle to it.
| state | The state object that contains the graphics context. |
| created | This value is set to true if the VAO is newly created. |
|
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.
| graphicsContext | The graphics context. |
|
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.
| graphicsContext | The graphics context. |
|
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.
| graphicsContext | The graphics context. |
|
protectedvirtual |
Handles window closing (context destroyed).
|
protectedvirtual |
internal
|
protected |
|
protected |
|
mutableprotected |
|
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.