Monday, October 15. 2007Leveraging Qt For Smooth Transition EffectsTrackbacks
Trackback specific URI for this entry
No Trackbacks
Comments
Display comments as
(Linear | Threaded)
glGetString(GL_RENDERER). If it contains "Mesa" on Linux, you know it's software-rendered. I'm not sure what the string is for the Windows and MacOSX software renderers, though.
Pretty amazing how fast it can be using OpenGL while changing nearly nothing to the source code!
I played a little with the code. Using QWidget, I get 3 to 5 frames on key_right animations. And then I have seen you used drawImage(). I'm used to Qt 3, so I tryed converting images to pixmaps after each scale, and simply use drawPixmap(). I was surprised to see no speed improvement! If I'm right, on Qt3, QImages are stored in aplication-memory RAM, while QPixmaps are stored in X server memory. So drawImage() need Qt to transform the QImage to a QPixmap and transfer it to the X server before being able to paint it. In Qt3, I see huge differences when painting only pixmaps when possible. Are Qt4 internals changed a lot? Is this application-side/server-side image/pixmap distinction not valid anymore? Anyway, thanks for this demo, I will play more with it when it's time for me to port Kirocker Music Display. I'm already excied about all wonderful animations I could add to my program just by using Qt4!
I can't refrain myself from playing more on this demo!
I tryed some transformation, especially rotation and translation. I came with this code: void TransitionWidget::paintEvent(QPaintEvent event) { Q_UNUSED(event) QPainter p(this); // p.setRenderHint(QPainter::Antialiasing, true); p.setRenderHint(QPainter::TextAntialiasing, true); // p.setRenderHint(QPainter::SmoothPixmapTransform, true); // p.setRenderHint(QPainter::HighQualityAntialiasing, true); p.setCompositionMode(QPainter::CompositionMode_SourceOver); p.drawImage(QPoint(0,0), mLastPic); QTransform transform; //transform.translate(50, 50); transform.rotate(90 - mBlendFactor 90); //transform.scale(mBlendFactor, mBlendFactor); p.setTransform(transform); p.drawImage(QPoint(height() - (int) (height() * mBlendFactor),0), mCurrentPic); } Quite nice (while not very perfect) looking. I post this code here, because I was obliged to comment the setRenderHint() calls. It was too slow with them enabled. Is there any reason for them to be slow, even using OpenGL? IMHO, that's pretty basic, considered OpenGL can render millions of polygons per second, why not anti-aliased four-polygons (2 per pixmap rectangle) My goal was trying to get cool animations ala Keynote. Perhapse I'm not using the good methods. After all, I'm still begining with Qt 4. |
QuicksearchMy Books on Qt 4Calendar
KategorienStatisticsLetzter Artikel: 2010-12-03 12:16
120 Artikel wurden geschrieben
222 Kommentare wurden abgegeben
1607 visitor(s) this month
PLUGIN_EVENT_STATISTICS_TEXT_DAYVISITORS
7 Besucher online
Blog AdministrationShow tagged entries |