21 #ifndef Tulip_QGLBUFFERMANAGER_H
22 #define Tulip_QGLBUFFERMANAGER_H
26 #include <tulip/tulipconf.h>
28 #include <QtOpenGL/QGLPixelBuffer>
29 #include <QtOpenGL/QGLFramebufferObject>
36 class TLP_QT_SCOPE QGlBufferManager {
43 static QGlBufferManager &getInst() {
45 inst=
new QGlBufferManager();
50 static void clearBuffers() {
54 for(std::map<std::pair<int,int>,QGLPixelBuffer*>::iterator it=inst->widthHeightToBuffer.begin(); it!=inst->widthHeightToBuffer.end(); ++it)
57 for(std::map<std::pair<int,int>,QGLFramebufferObject*>::iterator it=inst->widthHeightToFramebuffer.begin(); it!=inst->widthHeightToFramebuffer.end(); ++it)
60 inst->widthHeightToBuffer.clear();
61 inst->bufferToWidthHeight.clear();
62 inst->widthHeightToFramebuffer.clear();
63 inst->framebufferToWidthHeight.clear();
69 bool canUsePixelBuffer() {
70 return pixelBufferWork;
76 bool canUseFramebufferObject() {
77 return framebufferObjectWork;
83 QGLPixelBuffer *getPixelBuffer(
int width,
int height);
88 QGLFramebufferObject *getFramebufferObject(
int width,
int height);
97 static QGlBufferManager* inst;
99 std::map<std::pair<int,int>,QGLPixelBuffer*> widthHeightToBuffer;
100 std::map<QGLPixelBuffer*,std::pair<int,int> > bufferToWidthHeight;
101 std::map<std::pair<int,int>,QGLFramebufferObject*> widthHeightToFramebuffer;
102 std::map<QGLFramebufferObject*,std::pair<int,int> > framebufferToWidthHeight;
104 bool pixelBufferWork;
105 bool framebufferObjectWork;
111 #endif // Tulip_QGLBUFFERMANAGER_H