Commit f868e67b authored by Matthias Möller's avatar Matthias Möller
Browse files

fix snapshot output format for transparent objects

git-svn-id: 383ad7c9-94d9-4d36-a494-682f7c89f535
parent b9920d8a
......@@ -2221,9 +2221,28 @@ void glViewer::snapshot(QImage& _image, int _width, int _height, bool _alpha, bo
//Qt FrameBuffer "toImage" function returns QImage::Format_ARGB32_Premultiplied. not desired
QFramebufferObjectFormat tempFormat;
QGLFramebufferObject temp(w,h, tempFormat);
if (format.samples() != 0)
//cannot directly read from a multisampled framebuffer.
//create new one without sampling and read from it
QRect rect(QPoint(0, 0), QSize(w,h));
QFramebufferObject::blitFramebuffer(&temp, rect, &fb, rect);
ACG::GLState::bindFramebuffer(GL_FRAMEBUFFER_EXT, temp.handle());
//get the framebuffer data
_image = QImage(w,h,QImage::Format_ARGB32);
_image = _image.mirrored(false,true);//convert from opengl to qt coordinates
ACG::GLState::bindFramebuffer(GL_FRAMEBUFFER_EXT, prevFbo);
// Reset alpha settings
......@@ -2239,7 +2258,6 @@ void glViewer::snapshot(QImage& _image, int _width, int _height, bool _alpha, bo
_image = fb.toImage().copy(0, 0, w, h);
if(_width != 0 || _height != 0) {
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment