PDA

View Full Version : QGL: Tearing in Fullscreenmode with two displays



beetleskin
18th January 2011, 17:16
Hi!

For some reason I need to draw OpenGL context with constant 60fps in fullscreen on the secondary monitor with synchronisation to the display's refresh rate (vsync). Therefore I set up a QGLWidget, with the format as follows:


MyQGLWidget glWidget;
QGLFormat glFormat;

glFormat.setDoubleBuffer(true);
glFormat.setDirectRendering(true);
glFormat.setSwapInterval(1);
glFormat.setAlpha(false);
glFormat.setDepth(false);
glWidget = new MyImgQGLWidget(glFormat, QApplication::desktop(););


Before entering the draw loop, I set up the fullscreen mode like this (to the secondary display):


glWidget->setWindowTitle(QApplication::translate("3D-Viewer", "3D-Viewer", 0, QApplication::UnicodeUTF8));

QRect screenRect = desktop->screenGeometry(desktop->primaryScreen() + 1);
glWidget->setGeometry(screenRect);

glWidget->showFullScreen();


Well... thats my screen setup. I call the paintGL() function in glWidget via synchronizing the widgets updateGL() function with a QTimer, which fires every 2 ms.
The big problem is, that I experience massive tearing. A horizontal line is crossing the screen every 1-2 seconds.

I implemented the same OpenGL code with similar screen settings with SDL and there is no tearing (so graphic card and display settings are fine). However I kind of need to use Qt for my purposes. The second observation is, that everything works fine when only one display is activated. But I need two :/

I've overwritten the glwidgets paintEvent(...) function in order to get to know how often it is drawn. This function is only called twice while initializing, but not constantly, so QT apparently doesnt update more often than vsync permits...

I can just speculate about the reason(s):
showFullScreen() does not set up an exclusive fullscreen mode in which the application (and no one else) is responsible for EVERY screen update?!

I'd be very happy with any suggestion to this strange problem ;)

cya!