[Qt-interest] QGraphicsFramework - OpenGL - Invalidate Problem

Enrico Ros enrico.qt at email.it
Mon Apr 20 10:08:33 CEST 2009


Usually OpenGL doesn't support partial updates. On games, for example, every 
object on the screen is redrawn many many times per second.

So, to answer question 1, the best update mode for QGraphicsView running on 
OpenGL is QGraphicsView::FullViewportUpdate (this is also written in the 
documentation).

About the performance:
 - I see you using the SampleBuffers.. this may slow down *many times* your 
OpenGL application.. just use  "new QGLWidget()" without arguments. 
SampleBuffers are needed for anti-aliased OpenGL primitive drawing, but chances 
are high that you don't need that.

 - Keep sure to use only optimized operations: the OpenGL QPainter accelerates 
for example pixmap (texture) blending and rect filling but you won't get an 
acceleration drawing, for example, an ellipse, because no such primitive exist 
in OpenGL.

 - Make sure, using FullViewportUpdate, that the framerate is up-to 50-60 
fps.. no more. It may happen (when animating graphicsitems for example) that 
many more paint events are issued.

 - You may need to drive the "update()" slot with a QTimer (better than your 
QTimerLine, I think) and stop automatic viewport Updates. If that is the case, 
you can also connect to the QGraphicsScene's "changed(...)" signal to set a 
dirty flag and issue the update, when the timer fires, only if the dirty flag is 
set.

 - Also profile your app with "valgrind --tool=callgrind" (and visualize the 
result with kcachegrind) to see where the bottlenecks are.

 - Of course using a faster graphics card or a lower resolution, helps a lot, 
as always ;-)

Enrico

 
 
 --
 Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f
 
 Sponsor:
 Per il tuo cellulare c'è m.email, hai tutto il web e la posta elettronica nella tua mano. Provalo gratuitamente
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8922&d=20-4



More information about the Qt-interest-old mailing list