Skip to content

Commit

Permalink
Qt5OpenGL: Framebufferobject rendering works and handles transparency…
Browse files Browse the repository at this point in the history
… and anti-aliasing
  • Loading branch information
wwmayer committed Mar 21, 2017
1 parent 27d76f3 commit 749ace7
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/Gui/View3DInventorViewer.cpp
Expand Up @@ -931,7 +931,7 @@ void View3DInventorViewer::savePicture(int w, int h, const QColor& bg, QImage& i
#if !defined(HAVE_QT5_OPENGL)
bool useCoinOffscreenRenderer = !QGLPixelBuffer::hasOpenGLPbuffers();
#else
bool useCoinOffscreenRenderer = !QtGLFramebufferObject::hasOpenGLFramebufferObjects();
bool useCoinOffscreenRenderer = true;
#endif
useCoinOffscreenRenderer = App::GetApplication().GetParameterGroupByPath
("User parameter:BaseApp/Preferences/Document")->
Expand Down Expand Up @@ -1331,13 +1331,24 @@ void View3DInventorViewer::setRenderType(const RenderType type)
gl->makeCurrent();
#if !defined(HAVE_QT5_OPENGL)
framebuffer = new QtGLFramebufferObject(width, height, QtGLFramebufferObject::Depth);
renderToFramebuffer(framebuffer);
#else
QOpenGLFramebufferObjectFormat fboFormat;
//fboFormat.setSamples(getNumSamples());
fboFormat.setSamples(getNumSamples());
fboFormat.setAttachment(QtGLFramebufferObject::Depth);
framebuffer = new QtGLFramebufferObject(width, height, fboFormat);
QtGLFramebufferObject* fbo = new QtGLFramebufferObject(width, height, fboFormat);
if (fbo->format().samples() > 0) {
renderToFramebuffer(fbo);
framebuffer = new QtGLFramebufferObject(fbo->size());
// this is needed to be able to render the texture later
QOpenGLFramebufferObject::blitFramebuffer(framebuffer, fbo);
delete fbo;
}
else {
renderToFramebuffer(fbo);
framebuffer = fbo;
}
#endif
renderToFramebuffer(framebuffer);
}
break;
case Image:
Expand Down

0 comments on commit 749ace7

Please sign in to comment.