PDA

View Full Version : using GPU with Qt applications



budda
24th August 2011, 05:42
Does anyone know if Qt offers support for using the GPU on newer graphics cards? Maybe for use with the QPainter, QGraphicsView/QGraphicsScene, and/or QPhono classes? If their isn't, is this on the table for Qt's next versions graphical driver?

wysota
24th August 2011, 09:29
Using GPU for what? For graphics? Sure, there are a bunch of classes in Qt for that, starting with QGLWidget.

high_flyer
24th August 2011, 13:53
Have a look at Qt3D (http://doc.qt.nokia.com/qt3d-snapshot/)

budda
24th August 2011, 16:31
I already have these books:

The Book of Qt4 The Art of Building Qt Applications
C GUI Programming with Qt4 2nd Edition
Advanced Qt Programming

I found this link after I posted this thread http://labs.qt.nokia.com/2010/04/07/using-opencl-with-qt/ and it seems to have what I am looking for. I had just noticed that a custom QPainter class that I wrote is eating up massive CPU usage. It does draw 1000's of small items, repeatedly, very quickly to the MainWindow Widget. And it does this amazingly compared to other current languages. But, it really costs on the CPU. It looks like the OpenCL will let me do this even faster... I have done 3D graphics in Visual C++ w/ OpenGL and Java, but haven't gotten to that in Qt yet. My real question, is then, if I can open up the GPU with OpenCL can I also use the read/write and image buffers on the GPU & Graphics Card RAM to chop it up into smaller work groups with a regular image for the specific purpose of using QConcurrent and uploading large .jpg images through a network connection much faster? Or is the GPU only used for displaying graphics?

wysota
24th August 2011, 16:54
OpenCL will not help you with drawing, at least not directly. It can help you with calculating stuff. If you are after drawing speed then you are after OpenGL and not OpenCL.

budda
25th August 2011, 06:37
well I have the drawing speed just fine with QPainter class. I was hoping to just move the processing load of drawing to the screen over to the GPU instead of the CPU. I can run 3 instances of the program on a Quad Core, 8 GIG system and max out all 4 cores. If OpenGL can let me draw without using so much CPU, then that would be great. So the GPU is only for floating point graphical math and not also just graphics calls? I stalled out with Qt graphics in QGraphicsViews & Scenes. So then, this whole thread is silly and I apologize for those that are reading this...

wysota
25th August 2011, 08:29
You can use the GPU for any kind of calculations that make sense to parallelize according to rules dictated by OpenCL (with 'C'). Apart from that you can use OpenGL (with 'G') to have hardware acceleration of drawing things. Of course you can use the GPU for both.

high_flyer
25th August 2011, 10:02
As a side not, you can use OpenGL with GLSL shaders for both.
In the shaders you do your math, if you have any.
But doing general purpose calculations in GLSL needs a different kind of thinking then usual...