3
0
Fork 0
mirror of https://github.com/lubosz/overte.git synced 2025-04-27 13:15:45 +02:00

Fix for the “ringing” issue. Don’t let Qt handle our buffer swaps. Handle the swaps ourselves.

This commit is contained in:
Geenz 2014-03-14 19:38:17 -04:00
parent 89a6ecd1c1
commit d02f0ba687

View file

@ -13,9 +13,9 @@
#include <QUrl>
#include <QMainWindow>
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();
}
}