Commit 362324d6 authored by schultz's avatar schultz

applied changes from code review for MSAA fix

parent 93d9766a
......@@ -138,7 +138,7 @@ glViewer::glViewer( QGraphicsScene* _scene,
glDebugLogger_(0),
#endif
pickCache_(0),
mouseCache_(0),
mouseCache_(nullptr),
updatePickCache_(true),
pickCacheSupported_(true),
constrainedRotationAxis_(std::numeric_limits<double>::quiet_NaN(), 0, 0),
......@@ -1574,11 +1574,9 @@ void glViewer::mousePressEvent(QGraphicsSceneMouseEvent* _e)
emit signalMakeActive();
const GLuint prevFBO = ACG::GLState::getFramebufferDraw();
static unsigned int creationHeight = 0;
static unsigned int creationWidth = 0;
static GLuint fboHandle;
//recreate FBO if gl area was resized
if (mouseCache_ != nullptr && (glWidth() != creationWidth || glHeight() != creationHeight))
if (mouseCache_ != nullptr && QFBOResized(mouseCache_))
{
deleteQFBO(mouseCache_);
mouseCache_ = nullptr;
......@@ -1586,13 +1584,13 @@ void glViewer::mousePressEvent(QGraphicsSceneMouseEvent* _e)
if (mouseCache_ == nullptr)
{
GLuint fboHandle;
int samples = 0;
creationHeight = glHeight();
creationWidth = glWidth();
createQFBO(mouseCache_, &fboHandle, creationWidth, creationHeight, &samples);
createQFBO(mouseCache_, &fboHandle, glWidth() , glHeight(), &samples);
}
ACG::GLState::bindFramebuffer(GL_FRAMEBUFFER_EXT, fboHandle);
bindQFBO(mouseCache_);
glScene_->update ();
// right button pressed => popup menu (ignore here)
......
......@@ -573,6 +573,8 @@ private:
// 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 bindQFBO(QOpenGLFramebufferObject* _ptr);
bool QFBOResized(QOpenGLFramebufferObject* _ptr);
void blitQFBO(QOpenGLFramebufferObject* _ptr1, const QRect& _size1, QOpenGLFramebufferObject* _ptr2, const QRect& _size2);
void deleteQFBO(QOpenGLFramebufferObject* _ptr);
......
......@@ -214,6 +214,20 @@ void glViewer::blitQFBO(QOpenGLFramebufferObject* _ptr1, const QRect& _size1, QO
//-----------------------------------------------------------------------------
bool glViewer::bindQFBO(QOpenGLFramebufferObject* _ptr)
{
return _ptr->bind();
}
//-----------------------------------------------------------------------------
bool glViewer::QFBOResized(QOpenGLFramebufferObject* _ptr1)
{
return _ptr1->size() != QSize(glWidth(), glHeight());
}
//-----------------------------------------------------------------------------
void glViewer::deleteQFBO(QOpenGLFramebufferObject* _ptr)
{
delete _ptr;
......
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