VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtGlDeleteObjectManager.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright(c) 2019 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 #pragma once
10 #include <vrvOsg/vrvOsg.h>
11 #include <vrvCore/DtDe.h>
15 
16 #include <OpenThreads/Thread>
17 #include <OpenThreads/Block>
18 
19 #include <osg/OperationThread>
20 #include <osg/Texture>
21 #include <osg/observer_ptr>
22 #include <osg/GraphicsContext>
23 
24 namespace osg
25 {
26  class GraphicsContext;
27 }
28 
29 namespace makVrv
30 {
34  {
35  public:
37  // pointer to make VC10 happy
38  typedef std::map< osg::observer_ptr<const osg::GraphicsContext>, TexturesArray* > MapGCToTexArray;
39 
41  // pointer to make VC10 happy
42  typedef std::map< osg::observer_ptr<const osg::GraphicsContext >, VAOArray*> MapContextsToVAOArray;
43 
45  // pointer to make VC10 happy
46  typedef std::map< osg::observer_ptr<const osg::GraphicsContext >, FBOArray*> MapContextsToFBOArray;
47 
48 
50  static DtGLDeleteObjectManager& instance(DtDe& de);
51 
53  virtual ~DtGLDeleteObjectManager();
54 
56  virtual void addHandleToDelete(unsigned int handle);
57 
59  virtual void addTextureIdToDelete(const osg::GraphicsContext* gContext, osg::Texture::TextureObject* to);
60 
62  virtual void addVertexArrayObjectToDelete(const osg::GraphicsContext* gContext, unsigned int vaoId);
63 
65  virtual void addFrameBufferObjectToDelete(const osg::GraphicsContext* gContext, unsigned int fboId);
66 
67  virtual void addFrameBufferObjectToDelete(osg::observer_ptr<const osg::GraphicsContext>& gContext, unsigned int fboId);
68 
70  virtual void flush(const osg::GraphicsContext* gc, unsigned int contextId);
71 
73  virtual void flushInvalidGcs(void);
74 
75  virtual void slot_displayToBeDestroyed(const std::string& displayName, DtDe *de);
76 
78  virtual void clearData();
79 
80  protected:
81 
84 
86  static void registerInstance(DtGLDeleteObjectManager* mgr, DtDe& de);
87 
89  static DtGLDeleteObjectManager* findInstance(DtDe& de);
90 
91  virtual void flushTexturesArray(std::vector<osg::ref_ptr<osg::Texture::TextureObject> >* texArr, const osg::GraphicsContext* gc, unsigned int contextId);
92 
93  virtual void deleteBuffers(void);
94  virtual void deleteTextures(const osg::GraphicsContext* gc, unsigned int contextId);
95  virtual void deleteVAOs(const osg::GraphicsContext* gc, unsigned int contextId);
96  virtual void deleteFBOs(const osg::GraphicsContext* gc, unsigned int contextId);
97 
98  virtual void flushVAOsForInvalidGcs(void);
99  virtual void flushFBOsForInvalidGcs(void);
100 
103 
106 
109 
112 
115 
117  };
118 
121  class DT_DLL_VRVOSG DtGlDeleteObjectJob : public osg::Operation
122  {
123  public:
126 
128  virtual void operator () (osg::Object * sv);
129 
130  protected:
131 
134  };
135 
136 
137 } // namespace makVrv
Manager to delete GLBuffer in the main thread.
Definition: DtGlDeleteObjectManager.h:33
Virtual base class.
Definition: DtVirtualBaseClass.h:22
DtDe & myDe
Definition: DtGlDeleteObjectManager.h:116
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
std::map< osg::observer_ptr< const osg::GraphicsContext >, TexturesArray * > MapGCToTexArray
Definition: DtGlDeleteObjectManager.h:38
DtLockedBufferedQueue< unsigned int > FBOArray
Definition: DtGlDeleteObjectManager.h:44
Contains makVrv::DtDe class.
MapGCToTexArray myGraphicsContextToTexturesArray
For keeping texture id&#39;s per context.
Definition: DtGlDeleteObjectManager.h:105
DtLockedBufferedQueue< unsigned int > VAOArray
Definition: DtGlDeleteObjectManager.h:40
Contains makVrv::DtLockedBufferedQueue class.
std::map< osg::observer_ptr< const osg::GraphicsContext >, VAOArray * > MapContextsToVAOArray
Definition: DtGlDeleteObjectManager.h:42
MapContextsToVAOArray myGraphicsContextToVAOArray
For keeping vertex array object id&#39;s per context.
Definition: DtGlDeleteObjectManager.h:108
A locked buffered queue which allows multiple writers and a single reader.
Definition: DtLockedBufferedQueue.h:27
DtSignalConnectionManager myConnections
Any signals to process.
Definition: DtGlDeleteObjectManager.h:114
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:24
Contains the DtGlBuffer class declaration.
std::map< osg::observer_ptr< const osg::GraphicsContext >, FBOArray * > MapContextsToFBOArray
Definition: DtGlDeleteObjectManager.h:46
DtLockedBufferedQueue< unsigned int > myGlBufferToDeleteList
list of handle to delete
Definition: DtGlDeleteObjectManager.h:102
DtGLDeleteObjectManager & myManager
Reference to the DtGLDeleteObjectManager.
Definition: DtGlDeleteObjectManager.h:133
Base class to provide boost signal/slot management.
DtLockedBufferedQueue< osg::ref_ptr< osg::Texture::TextureObject > > TexturesArray
Definition: DtGlDeleteObjectManager.h:36
Contains DLL export macros.
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
MapContextsToFBOArray myGraphicsContextToFBOArray
For keeping vertex array object id&#39;s per context.
Definition: DtGlDeleteObjectManager.h:111
Job to delete the queued GLBuffer on each frame.
Definition: DtGlDeleteObjectManager.h:121

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)