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();
84 void setZoomFactor(
double zoomFactor) {
85 this->zoomFactor = zoomFactor;
87 void setCameraCenter(
const Coord &cameraCenter) {
88 this->cameraCenter = cameraCenter;
91 void setSceneBackgroundColor(
const Color &color);
95 void addGlEntityToScene(GlSimpleEntity *entity);
99 void addGraphCompositeToScene(GlGraphComposite *graphComposite);
104 void addGraphToScene(Graph *graph);
109 void clearScene(
bool deleteGlEntities =
false);
115 void renderScene(
const bool centerScene =
true,
const bool antialiased =
false);
117 void renderExternalScene(GlScene *scene,
const bool antialiased =
false);
119 QImage renderGlMainWidget(GlMainWidget *glWidget,
bool redrawNeeded);
125 QImage getImage(
bool alpha =
false);
130 GLuint getGLTexture(
const bool generateMipMaps =
false);
132 QOpenGLContext *getOpenGLContext();
133 void makeOpenGLContextCurrent();
134 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;