Hi all,

after updating my application from Qt 4.8 to Qt 5.4 I was facing problems with my QGLWidget. I got some strange white rectangles and painting problems on OS X (it is a multi-platform application and there were no problems on Windows). Since QGLWidget is deprecated I decided to change my implementation. Unfortunately I can't use the newly introduced QOpenGLWidget since I need full control over the buffer swap and rendering into an FBO is not an option right now. After reading some threads I finally chose to implement it the way it is explained in the OpenGL Window Example of Qt 5.4 (http://doc.qt.io/qt-5/qtgui-openglwindow-example.html). In short, QWindow with OpenGL surface and a QOpenGLContext. For getting a widget out of the window I am using QWidget::createWindowContainer. Everything works pretty good except two problems:
  1. My OpenGL widget can have a fixed size. It is child of a layouting widget which is the central widget of my main window. The OpenGL widget is always put in the center of the layouting widget. I also have dock widgets to the left and right as well as toolbars. Now when resizing the the main window it can happen that the size of the central widget is smaller than the fixed size of my OpenGL render widget. In that case it is moved outside of the central widget area and should be covered by the toolbars and the dock widgets. But this is unfortunately not happening. It is always drawn on top of everything. This scenario was working with the old and now deprecated QGLWidget. I attached some screenshot which show the problem.
    Screen Shot 2015-05-06 at 14.45.59.jpg Screen Shot 2015-05-06 at 14.46.30.png Screen Shot 2015-05-06 at 14.46.41.png
  2. The second problem is related to vsync. On my Mac it seems to work if I set the swap interval to zero in the surface format. However I am still limited to 60 fps which reflects my monitor refresh rate. With the QGLWidget I am getting around 200 fps with the same test scene. Is there anything else I need to take care of? However, on my Windows machine setting the swap interval to zero does not seem to have any impact at all. Vsync is always on.


Any help is highly appreciated. If necessary I can post the source code of my demo scene.

Thanks,
Marcus