[Qt-interest] QGL2PaintEngineEx vc QGLContext

John Clayton john_clayton at me.com
Wed Dec 9 14:23:03 CET 2009


Hi All

 From testing - I notice that drawing a texture to my GL surface (on a  
Mac, using 4.6.0, in a QGraphicsItem paint() method) can be done in  
two different ways.

Method 1 - use QPainter->drawImage(QRectF, QImage)

or

Method 2 - use QGLWidget->drawTexture(QRectF, int, int)

Method 1 works perfectly in my case, and looking at its code it is  
using the new Qt4.6 opengl code.
Method 2 fails to draw anything (it used to work in 4.5.3), and the  
code to draw looks *totally* different compared with Method 1.

So, how can I use Method 1 to draw - given that i have a texture ID.   
My requirement is to draw textures into a QGraphicsItem, and QGLWidget- 
 >drawTexture() appears to fit the bill - but it doesn't draw anything  
(unless I call beginNativePainting first - but that wipes out the  
clipping path).

Is there a way I can use the QPainter based method to draw textures?

Thanks
--
John Clayton
Skype: johncclayton







More information about the Qt-interest-old mailing list