Tulip  5.3.0
Large graphs analysis and drawing
QGlBufferManager.h
1 /*
2  *
3  * This file is part of Tulip (http://tulip.labri.fr)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 #ifndef Tulip_QGLBUFFERMANAGER_H
22 #define Tulip_QGLBUFFERMANAGER_H
23 
24 #include <map>
25 
26 #include <tulip/tulipconf.h>
27 #include <QOpenGLFramebufferObject>
28 
29 namespace tlp {
30 
31 /** \brief Class to manage QGlFramebufferObject
32  */
33 class TLP_QT_SCOPE QGlBufferManager {
34 
35 public:
36  static void clearBuffers();
37 
38  /**
39  * Return if QGlFramebufferObject can be used
40  */
41  static bool canUseFramebufferObject() {
42  return QOpenGLFramebufferObject::hasOpenGLFramebufferObjects();
43  }
44 
45  /**
46  * Return a QOpenGLFramebufferObject with given size
47  */
48  static QOpenGLFramebufferObject *getFramebufferObject(int width, int height);
49 
50 private:
51  static std::map<std::pair<int, int>, QOpenGLFramebufferObject *> widthHeightToFramebuffer;
52  static std::map<QOpenGLFramebufferObject *, std::pair<int, int>> framebufferToWidthHeight;
53 };
54 } // namespace tlp
55 
56 #endif // Tulip_QGLBUFFERMANAGER_H
57 ///@endcond