mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 12:04:18 +02:00
Fix for the “ringing” issue. Don’t let Qt handle our buffer swaps. Handle the swaps ourselves.
This commit is contained in:
parent
89a6ecd1c1
commit
d02f0ba687
1 changed files with 7 additions and 2 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue