[Qt-interest] Fast Scaling of Images
Till Oliver Knoll
till.oliver.knoll at gmail.com
Tue Apr 19 08:52:24 CEST 2011
Am 16.04.2011 um 07:05 schrieb Joshua Grauman <jnfo-c at grauman.com>:
> I've never used openGL, would it be possible to pass off scaling of
> the image to openGL? If so, can anyone get me started in the right
> direction for how to do that?
>>
>>
The "cheap" way would be to use a QGraphicsScene/View with an underlying QGLWidget, refer to QGraphicsView#setRenderWidget (or the like).
Like this many operations - with a little bit of luck scaling as well - are then passed onwards to OpenGL.
Use a QGraphicsPixmapItem for your bitmap.
The "expensive" but optimal way would be to implement your own GL solution in a QGLWidget based widget. Grab a book or check out the tutorials on the web ("textures" would be a good starting point).
But note that many "raw" GL commands have been deprecated, notably most of the "geometry" functions: glVertex and Co. The basic idea since OpenGL 3 is to upload the whole geometry "at once" into the the graphic card memory using "vertex buffers" or so.
"Quads" have also been deprecated, so your image would be two triangles (forming a rectangle) with a texture on top (the image).
Oh and yes, most matrix operations have also been deprecated in OpenGL 3 ;) (A good thing Qt came up with its own matrix classes to support viewport/world transformations ;)
So for instance glScale() is deprecated, you need to come up with your own "scaling matrix" now (that's where the Qt matrix classes jump in - or other matrix/"game" libraries).
Oh, and one more thing: "At least turn the light on when you point the camera into the wrong direction with regards to a black cube in front of a black background!" ;) (your first "Hello GL world!" so to say ;)
Good luck!
Oliver
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110419/5d0dae8f/attachment.html
More information about the Qt-interest-old
mailing list