21 #ifndef GLOFFSCREENRENDERER_H_ 22 #define GLOFFSCREENRENDERER_H_ 24 #include <tulip/tulipconf.h> 25 #include <tulip/Coord.h> 26 #include <tulip/GlScene.h> 28 #include <tulip/OpenGlIncludes.h> 33 class QOffscreenSurface;
34 class QOpenGLFramebufferObject;
39 class GlGraphComposite;
62 class TLP_QT_SCOPE GlOffscreenRenderer {
68 inline static GlOffscreenRenderer *getInstance() {
72 ~GlOffscreenRenderer();
77 void setViewPortSize(
const unsigned int viewPortWidth,
const unsigned int viewPortHeight);
78 unsigned int getViewportWidth();
79 unsigned int getViewportHeight();
80 bool frameBufferOk()
const;
85 void setZoomFactor(
double zoomFactor) {
86 this->zoomFactor = zoomFactor;
88 void setCameraCenter(
const Coord &cameraCenter) {
89 this->cameraCenter = cameraCenter;
92 void setSceneBackgroundColor(
const Color &color);
96 void addGlEntityToScene(GlSimpleEntity *entity);
100 void addGraphCompositeToScene(GlGraphComposite *graphComposite);
105 void addGraphToScene(Graph *graph);
110 void clearScene(
bool deleteGlEntities =
false);
116 void renderScene(
const bool centerScene =
true,
const bool antialiased =
false);
118 void renderExternalScene(GlScene *scene,
const bool antialiased =
false);
120 void renderGlMainWidget(GlMainWidget *glWidget,
bool redrawNeeded =
true);
131 GLuint getGLTexture(
const bool generateMipMaps =
false);
133 QOpenGLContext *getOpenGLContext();
134 void makeOpenGLContextCurrent();
135 void doneOpenGLContextCurrent();
138 GlOffscreenRenderer();
140 void initFrameBuffers(
const bool antialiased);
142 static GlOffscreenRenderer *instance;
144 QOpenGLContext *glContext;
145 QOffscreenSurface *offscreenSurface;
147 unsigned int vPWidth, vPHeight;
148 QOpenGLFramebufferObject *glFrameBuf, *glFrameBuf2;
151 unsigned int entitiesCpt;