18 #ifndef EQUTIL_OBJECTMANAGER_H
19 #define EQUTIL_OBJECTMANAGER_H
21 #include <eq/util/types.h>
22 #include <eq/client/api.h>
24 #include <lunchbox/api.h>
25 #include <lunchbox/debug.h>
26 #include <lunchbox/hash.h>
27 #include <lunchbox/nonCopyable.h>
28 #include <lunchbox/referenced.h>
58 template<
class T >
class ObjectManager :
public lunchbox::NonCopyable
75 bool isShared()
const {
return _data->getRefCount() > 1; }
83 EQ_API
unsigned getList(
const T& key )
const;
84 EQ_API
unsigned newList(
const T& key,
const int num = 1 );
85 EQ_API
unsigned obtainList(
const T& key,
const int num = 1 );
86 EQ_API
void deleteList(
const T& key );
88 EQ_API
unsigned getTexture(
const T& key )
const;
89 EQ_API
unsigned newTexture(
const T& key );
90 EQ_API
unsigned obtainTexture(
const T& key );
91 EQ_API
void deleteTexture(
const T& key );
93 EQ_API
bool supportsBuffers()
const;
94 EQ_API
unsigned getBuffer(
const T& key )
const;
95 EQ_API
unsigned newBuffer(
const T& key );
96 EQ_API
unsigned obtainBuffer(
const T& key );
97 EQ_API
void deleteBuffer(
const T& key );
99 EQ_API
bool supportsPrograms()
const;
100 EQ_API
unsigned getProgram(
const T& key )
const;
101 EQ_API
unsigned newProgram(
const T& key );
102 EQ_API
unsigned obtainProgram(
const T& key );
103 EQ_API
void deleteProgram(
const T& key );
105 EQ_API
bool supportsShaders()
const;
106 EQ_API
unsigned getShader(
const T& key )
const;
107 EQ_API
unsigned newShader(
const T& key,
const unsigned type );
108 EQ_API
unsigned obtainShader(
const T& key,
const unsigned type );
109 EQ_API
void deleteShader(
const T& key );
111 EQ_API
Accum* getEqAccum(
const T& key )
const;
112 EQ_API
Accum* newEqAccum(
const T& key );
113 EQ_API
Accum* obtainEqAccum(
const T& key );
114 EQ_API
void deleteEqAccum(
const T& key );
117 EQ_API lunchbox::Uploader* getEqUploader(
const T& key )
const;
119 EQ_API lunchbox::Uploader* newEqUploader(
const T& key );
121 EQ_API lunchbox::Uploader* obtainEqUploader(
const T& key );
123 EQ_API
void deleteEqUploader(
const T& key );
125 EQ_API
bool supportsEqTexture()
const;
126 EQ_API
Texture* getEqTexture(
const T& key )
const;
127 EQ_API
Texture* newEqTexture(
const T& key,
const unsigned target );
128 EQ_API
Texture* obtainEqTexture(
const T& key,
const unsigned target );
129 EQ_API
void deleteEqTexture(
const T& key );
131 EQ_API
bool supportsEqFrameBufferObject()
const;
135 EQ_API
void deleteEqFrameBufferObject(
const T& key );
137 EQ_API
bool supportsEqPixelBufferObject()
const;
140 const bool threadSafe );
142 const bool threadSafe );
143 EQ_API
void deleteEqPixelBufferObject(
const T& key );
148 EQ_API
void deleteEqBitmapFont(
const T& key );
150 const GLEWContext* glewGetContext()
const {
return _data->glewContext; }
159 typedef stde::hash_map< T, Object > ObjectHash;
160 typedef stde::hash_map< T, Texture* > TextureHash;
161 typedef stde::hash_map< T, FrameBufferObject* > FBOHash;
162 typedef stde::hash_map< T, PixelBufferObject* > PBOHash;
163 typedef stde::hash_map< T, util::BitmapFont< T >* > FontHash;
164 typedef stde::hash_map< T, Accum* > AccumHash;
165 typedef stde::hash_map< T, lunchbox::Uploader* > UploaderHash;
166 # ifdef EQ_OM_TRACE_ALLOCATIONS
167 typedef stde::hash_map< T, std::string > UploaderAllocs;
170 struct SharedData :
public lunchbox::Referenced
172 SharedData(
const GLEWContext* glewContext );
173 virtual ~SharedData();
175 GLEWContext*
const glewContext;
181 ObjectHash uploaderDatas;
183 TextureHash eqTextures;
184 FBOHash eqFrameBufferObjects;
185 PBOHash eqPixelBufferObjects;
187 UploaderHash eqUploaders;
188 # ifdef EQ_OM_TRACE_ALLOCATIONS
189 UploaderAllocs eqUploaderAllocs;
198 typedef lunchbox::RefPtr< SharedData > SharedDataPtr;
207 #endif // EQUTIL_OBJECTMANAGER_H
A C++ class to abstract OpenGL frame buffer objects.
ObjectManager(const GLEWContext *const glewContext)
Construct a new object manager.
A wrapper around AGL, WGL and GLX bitmap fonts.
void deleteAll()
Delete all managed objects and associated GL objects.
A C++ class to abstract an accumulation buffer.
A wrapper around OpenGL textures.
util::ObjectManager< const void * > ObjectManager
The OpenGL object manager used in the client library.
A C++ class to abstract OpenGL pixel buffer objects.