Qt5OpenGL: fix transparency issue with framebuffer objects with old OpenGL API

This commit is contained in:
wmayer
2017-03-12 22:34:00 +01:00
parent f13538a016
commit 79f961ee9c
4 changed files with 10 additions and 3 deletions

View File

@@ -589,6 +589,8 @@ SoQtOffscreenRenderer::makeFrameBuffer(int width, int height, int samples)
fmt.setAttachment(QtGLFramebufferObject::Depth);
#if defined(HAVE_QT5_OPENGL)
fmt.setInternalTextureFormat(GL_RGB32F_ARB);
#else
fmt.setInternalTextureFormat(GL_RGB);
#endif
#else
QtGLFramebufferObject::Attachment fmt;

View File

@@ -136,14 +136,15 @@ void Thumbnail::createThumbnailFromFramebuffer(QImage& img) const
// Alternative way of off-screen rendering
if (this->viewer->isActiveWindow()) {
static_cast<QtGLWidget*>(this->viewer->getGLWidget())->makeCurrent();
#if defined(HAVE_QT5_OPENGL)
QtGLFramebufferObjectFormat format;
format.setAttachment(QtGLFramebufferObject::Depth);
#if defined(HAVE_QT5_OPENGL)
format.setInternalTextureFormat(GL_RGB32F_ARB);
QtGLFramebufferObject fbo(this->size, this->size, format);
#else
QtGLFramebufferObject fbo(this->size, this->size, QtGLFramebufferObject::Depth);
format.setInternalTextureFormat(GL_RGB);
#endif
QtGLFramebufferObject fbo(this->size, this->size, format);
this->viewer->renderToFramebuffer(&fbo);
img = fbo.toImage();
static_cast<QtGLWidget*>(this->viewer->getGLWidget())->doneCurrent();

View File

@@ -588,6 +588,8 @@ void View3DInventor::previewFromFramebuffer(const QRect& rect, QImage& img)
format.setAttachment(QtGLFramebufferObject::Depth);
#if defined(HAVE_QT5_OPENGL)
format.setInternalTextureFormat(GL_RGB32F_ARB);
#else
format.setInternalTextureFormat(GL_RGB);
#endif
QtGLFramebufferObject fbo(rect.width(), rect.height(), format);
#else

View File

@@ -710,6 +710,8 @@ void View3DInventorPy::createImageFromFramebuffer(int width, int height, const Q
format.setAttachment(QtGLFramebufferObject::Depth);
#if defined(HAVE_QT5_OPENGL)
format.setInternalTextureFormat(GL_RGB32F_ARB);
#else
format.setInternalTextureFormat(GL_RGB);
#endif
QtGLFramebufferObject fbo(width, height, format);
#else