PDA

View Full Version : Paint with OpenGL



kernel_panic
17th December 2008, 11:16
Hello!
Im doing some wasting paintings in my app so the computer and the app are getting very slow with the standard Qt PaintEngine. Now I wanted to know from you geeks, if and how its possible to use OpenGL instead of Qt Engine.
I know, its possible with QGraphicsView. I know, sth like that will come with Qt 4.5. But i cant wait for the release.
So can OpenGL be attached to a normal QWidget? Have i to use QGLWidget or is it only possible if i redirect all drawings to a QGraphicsView?
Cheers!

wysota
18th December 2008, 08:43
You can use QGraphicsProxyWidget with graphics view, but the first question you should ask yourself is "why is my application so slow?". A widget composed from other widgets shouldn't be slow. And a custom widget can probably be implemented using QGLWidget.

kernel_panic
18th December 2008, 09:54
The application IS slow because i paint more than 1000 objects...
For the Pimp My Widget Contest im writing an effects library. These effects can be attached to all kind of widgets. For some effects i cut the widgets into particles. The particles can reach a huge amount which rendering isnt realisable with the Qt paint engine.
Here (http://www.imgimg.de/bild_effectsdb30c4d0png.png.html) a pic of the effects i yet have. with big particle size. which doenst really look pretty.

wysota
18th December 2008, 10:38
I wouldn't expect miracles then. What you can do is to set the DontShowOnScreen attribute on all widgets and call QWidget::render() on them to render them to an OpenGL buffer which you can then modify as you want and/or show on a QGLWidget. The downside is that you'll have to forward all the events to appropriate widgets.

manishkyl
7th April 2009, 06:15
I need to do a similar thing ..
but I dont find this attribute.,, DontShowOnScreen..in Qt documentation..

wysota
7th April 2009, 08:54
Because it's not documented.

WA_DontShowOnScreen = 103