[Qt-interest] invalid drawable with Cocoa/QGLWidget

Karl Merkley karl at elemtech.com
Thu Feb 25 21:16:12 CET 2010


On Feb 25, 2010, at 11:46 AM, Alan Norton wrote:

> Thanks, Oliver.
> I have a bit more information.  This problem seems to only occur if  
> the
> qglwidget is not visible when it first gets a paintEvent().  In my
> example the qglwidget is scrolled out of view when its containing  
> widget
> first is shown.  I suspect that Qt is creating the OpenGL context  
> right
> before or right after the containing widget gets the first  
> paintEvent(),
> but I don't know how to intercept this before it fails.
> -Alan
> Oliver.Knoll at comit.ch wrote:
>> Alan Norton wrote on Thursday, February 25, 2010 6:03 PM:
>>
>>
>>> With Cocoa on Mac OSX10.5, I get a message "invalid drawable" (and a
>>> defective image) whenever my QGLWidget redraws.
>>>
>>
>> I can confirm that I use a QGLWidget with Qt 4.6 binary build Cocoa  
>> on Mac OS 10.6.2 without problems :) I know, that is little help to  
>> your problem, but it might make the "future" a bit brighter ;) (and  
>> be a strong hint that the problem really seems to be in the GL  
>> driver shipped with Mac OS 10.5 or wherever, assuming that you are  
>> also using the latest Qt 4.6.x).
>>
>> The stuff which is drawn is admittedly very simple: 2 triangles  
>> with a texture on it, using Qt shader programs (so basically I draw  
>> a "photo" ;)
>>
>> Cheers, Oliver
>>


You must make sure that initializeGL is called prior to making any  
OpenGL calls.   If your window isn't being displayed it may be a  
timing problem with when the initialize is called.

   Karl








More information about the Qt-interest-old mailing list