Please report a bug, at first glance it looks like an oversight. Thanks, Laszlo
Get Outlook for iOS<https://aka.ms/o0ukef> ________________________________ From: Interest <interest-bounces+laszlo.agocs=qt...@qt-project.org> on behalf of ole-qt-2...@mail.plastictree.net <ole-qt-2...@mail.plastictree.net> Sent: Monday, March 6, 2017 11:18:24 AM To: interest@qt-project.org Subject: [Interest] Using QOpenGLFramebufferObject with QGraphicsView The QOpenGLWidget has a GL framebuffer in which it expects everything to be rendered. This framebuffer is not the system's default framebuffer. QOpenGLContext::defaultFramebufferObject() returns the default framebuffer. This function is used in QOpenGLFramebufferObject::release() to rebind the default framebuffer after one is done with using one's own. Now, for this to work with QOpenGLWidget it is necessary for defaultFramebufferObject() to return not the system's default, but the framebuffer used by the widget. Otherwise calling QOpenGLFramebufferObject::bind() and subsequently release() will leave you rendering into the system's default framebuffer 0 while the widget expects you to render to, say, framebuffer 3. Looking at the sources shows that QOpenGLWidget, before calling a virtual paintGL() method, sets a flag on QOpenGLContext to make its defaultFramebufferObject() method return the correct framebuffer. QOpenGLFramebufferObject::bind() and release() inside the paintGL() method do therefore work as expected. So far so good. This is also all documented like this. We are, however, using QOpenGLWidget as viewport for QGraphicsView. When using QOpenGLFramebufferObject inside QGraphicsEffect::draw() the aformentioned intialization step that modifies QOpenGLContext::defaultFramebufferObject()'s behaviour seems to be missing. A call to QOpenGLFramebufferObject::release() leaves you with the wrong framebuffer bound. We have to manually save the framebuffer id before QOpenGLFramebufferObject::bind() and restore it later. Now my question is: Is QOpenGLFramebufferObject not supposed to be used with QGraphicsView or is there an oversight in QGraphicsView, failing to set the correct default framebuffer before calling any user-overriden draw() methods? (Or, more plainly: Should I report a bug for this?) Best regards Ole
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest