I want to implement a function that saves the content displayed by the OpenGLWidget to an image file.
I'm using the following code to save the image:
ui->gl_widget->grabFramebuffer().save("/foo/bar.png");
This works fine as long as I don't use multisampling, but if I add this line to my initialization, I only get weird looking results:
QSurfaceFormat format;
...
format.setSamples(4);
...
additionally, rendering a static scene multiple times results in different images.
I'm using Qt5.6.0 and OpenGL 3.3 (Core Profile).
Can you help me to find the problem here? I searched quite some time now and I don't have a clue what's causing this issue.
Thanks in advance!