[Qt-interest] invalid drawable with Cocoa/QGLWidget
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Tue Mar 2 12:03:00 CET 2010
Alan Norton wrote on Friday, February 26, 2010 11:27 PM:
> Oliver,
> I have found a workaround for this, but it's a real kludge. I can
> call hide() on the QGLWidget when it's first created, and then call
> show() when it is truly exposed (by checking its position relative to
> the scrollbar). I tried altering the resizeEvents but that didn't
> work. Evidently the context is set up after, not during the
> resizeEvent. showEvent didn't help either.
I modified the ${QTDIR}/examples/opengl/textures example: I added 2 "GLWidgets" into a scrollbar, such that the first is visible and the 2nd is in the invisible area of the scrollbar.
That works as expected on Windows XP, but I am afraid I have to confirm the behaviour you have described on Mac OS 10.6.2 as well (using Qt 4.6.0): the first GLWidget is displayed properly (but I also noticed that it is not properly scrolled left/right), whereas the 2nd GLWidget, when becoming visible, is basically only painting the background colour, with some "garbage pixels" at the bottom which appear to keep randomly changing.
> I regard this as a Qt
> bug since there is no API exposed to the user to enable one to
> properly initialize a scrolled qglwidget. -Alan
It is probably more a "design bug" within Qt, one that was probably not foreseeable when the QGLWidget was implemented. The current implementation seems to rely on that a QGLContext can be properly setup, even if there "drawable surface" is not yet visible. And this apparently works on Windows, Linux, most Unix... but not on Mac/Cocoa.
And you mentioned discussion forums which tell that with Cocoa the widget must be visible, only then can an OpenGL context be created. This seems to be very Mac/Cooca specific :( Talking about Cocoa: did you also try the Carbon Qt build? Or is it really Cococa-specific?
Anyway, I will try to reduce the 'texture' examples to its core and create a bug report. But I don't think the solution should be to expose an API to support "scrollable QGLWidgets" - it should "just work" with the current API, without worrying about whether the QGLWidget is visible at the time of initialisation or not. (And if it would require your workaround, then this should happen "under the Qt hood")
Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list