Commit 5c1e885d authored by Martin Schultz's avatar Martin Schultz

fixed snapshot functions, as wrong samples were checked and changed

wrapper function signature
parent 9974fb11
......@@ -2272,13 +2272,12 @@ void glViewer::snapshot(QImage& _image, int _width, int _height, bool _alpha, bo
GLuint tempHnd;
int testSamples = -1;
createQFBO(temp, &tempHnd, w, h, &testSamples);
if (testSamples != 0)
if (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);
blitQFBO(temp, rect, fb, rect);
ACG::GLState::bindFramebuffer(GL_FRAMEBUFFER_EXT, tempHnd);
}
......
......@@ -572,7 +572,7 @@ private:
void makeWidgetCurrent();
// wrapper to create QFramebufferObject returns true if QFBO is valid if samples is -1 the default samples are retrieved
bool createQFBO(QOpenGLFramebufferObject* _ptr, GLuint* _handle, int _width, int _height, int* _samples);
bool createQFBO(QOpenGLFramebufferObject*& _ptr, GLuint* _handle, int _width, int _height, int* _samples);
void blitQFBO(QOpenGLFramebufferObject* _ptr1, const QRect& _size1, QOpenGLFramebufferObject* _ptr2, const QRect& _size2);
void deleteQFBO(QOpenGLFramebufferObject* _ptr);
......
......@@ -164,7 +164,7 @@ void glViewer::makeWidgetCurrent()
//-----------------------------------------------------------------------------
bool glViewer::createQFBO(QOpenGLFramebufferObject* ptr, GLuint* _handle, int _width, int _height, int* _samples)
bool glViewer::createQFBO(QOpenGLFramebufferObject*& ptr, GLuint* _handle, int _width, int _height, int* _samples)
{
QFramebufferObjectFormat format;
format.setInternalTextureFormat(GL_RGBA);
......@@ -177,10 +177,6 @@ bool glViewer::createQFBO(QOpenGLFramebufferObject* ptr, GLuint* _handle, int _w
// it will fall back to the maximal supported number of samples
format.setSamples(*_samples);
}
else //retrieve sample count otherwise
{
*_samples = format.samples();
}
QFramebufferObject* fb;
fb = new QFramebufferObject(_width, _height, format);
......@@ -188,6 +184,7 @@ bool glViewer::createQFBO(QOpenGLFramebufferObject* ptr, GLuint* _handle, int _w
if(fb->isValid())
{
*_handle = fb->handle();
*_samples = fb->format().samples(); // store the actual samples qt uses
return true;
}
else
......
Markdown is supported
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