Rotation and scale of images using opengl?
| Wed, 2007-08-01 10:43 | |
|
So I was thinking about using OpenGL to rotate them in order to transfer all this interpolation tasks to the graphics processor. How can I transform 2D images (i.e. pictures, photographs) in OpenGL in the easiest way? Any advice will be ok. Is it possible to charge the image as a texture and apply this transformations to the texture without rendering anything, getting the texture back again?
|
|






Forum posts: 1246
Yes, you can do this, by creating an offscreen render target, for example pbuffers, and render to this.
Then copy out the pixels through eglCopyBuffers
Here is a discussion on forum.nokia about the different options:
http://discussion.forum.nokia.com/forum/showthread.php?t=107137&highlight=pbuffer
Its about mixing GL with symbian native drawing, but has some good tips.
Forum posts: 17
Thanks a lot. I don´t know if it will be fast enough, but maybe I can save some processor time sending this image rotations and scales through the graphical accelerator.
Forum posts: 1246
Note though that only very few high end phones actually have graphical hardware.
Though, all s60 3.0+ phones has software emulation of opengl if hw is not present.
I think it is a good idea to use this though, no sense reimplementing a lot of functions if they already are there in good condition.
If you want realtime animations, you should display it through opengl too.
It will anyway certainly be fast enough for doing some pre-processing of the image.
Only problem I can think of right now is that the graphics memory might be quite limited (and is quite limited overall), so you might have problems if you want to do this processing on very big images (you mentioned photos).
Processing very big images on the phone is tricky in any case though, and takes a lot of work and effort to get to work efficiently (or at all)
Forum posts: 17
Actually I have to do it for just HW accelerated graphic Devices and the size of the images is not too big (240x320 so about the resolution of one screen).
The main app uses all the processor time that it can get to calculate all the rotation parameters and i would like to derive the graphic tasks a little bit in order to make it faster.
It is an application that runs in real time but i not need to display anything on the screen, just get the results.