From d02f0ba6870b7008fbd08d1648480a8afa5e59cd Mon Sep 17 00:00:00 2001 From: Geenz Date: Fri, 14 Mar 2014 19:38:17 -0400 Subject: [PATCH] =?UTF-8?q?Fix=20for=20the=20=E2=80=9Cringing=E2=80=9D=20i?= =?UTF-8?q?ssue.=20=20Don=E2=80=99t=20let=20Qt=20handle=20our=20buffer=20s?= =?UTF-8?q?waps.=20=20Handle=20the=20swaps=20ourselves.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- interface/src/GLCanvas.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/interface/src/GLCanvas.cpp b/interface/src/GLCanvas.cpp index b68c4fdacd..ea04002ddb 100644 --- a/interface/src/GLCanvas.cpp +++ b/interface/src/GLCanvas.cpp @@ -13,9 +13,9 @@ #include #include -GLCanvas::GLCanvas() : QGLWidget(QGLFormat(QGL::NoDepthBuffer, QGL::NoStencilBuffer)), +GLCanvas::GLCanvas() : QGLWidget(QGLFormat(QGL::NoDepthBuffer)), _throttleRendering(false), - _idleRenderInterval(100) + _idleRenderInterval(64) { } @@ -25,11 +25,15 @@ void GLCanvas::initializeGL() { setAcceptDrops(true); connect(Application::getInstance(), SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(activeChanged(Qt::ApplicationState))); connect(&_frameTimer, SIGNAL(timeout()), this, SLOT(throttleRender())); + + // Note, we *DO NOT* want Qt to automatically swap buffers for us. This results in the "ringing" bug mentioned in WL#19514 when we're throttling the framerate. + setAutoBufferSwap(false); } void GLCanvas::paintGL() { if (!_throttleRendering && !Application::getInstance()->getWindow()->isMinimized()) { Application::getInstance()->paintGL(); + swapBuffers(); } } @@ -86,6 +90,7 @@ void GLCanvas::throttleRender() { _frameTimer.start(_idleRenderInterval); if (!Application::getInstance()->getWindow()->isMinimized()) { Application::getInstance()->paintGL(); + swapBuffers(); } }