Mapping a texture

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Mapping a texture

AlexRNL
Hi guys!

I have a problem with OpenGL (& JOGL) and I was hoping you could help me :)

So the idea is that I build an image with coordinates which I receive in the polar system. To avoid computation (this image receives a LOT of data) I'm storing them directly into a BufferedImage (r -> x & θ -> y). Basically, I end up with an distorted image.

Then I transform this image into an OpenGL texture and I was wondering if it was possible that OpenGL mapped that texture into polar coordinates system. Or maybe to map it onto a gluDisk quadric (so it has the right shape).

In case that is not possible, I was thinking of drawing a circle with many triangles (so it would look like an almost perfect circle) and apply the texture on each vertices of those triangles.

With this post I am joining a image which expose more clearly (i hope so...) my problem.
my problem
Please do not hesitate to ask for more details if it is explained badly (English is not my primary language ^^).

Thanks,
Alex.
Reply | Threaded
Open this post in threaded view
|

Re: Mapping a texture

Demoscene Passivist
Administrator
Yes, u could definetly do that with OpenGL.

I would suggest using "OpenGL Shading Language" (GLSL) for the tranformation u wanna do. OpenGL shaders really fast and could easily handle ur problem in realtime.

To get an idea of how to do the "cartesian to polar" and "polar to cartesian" transformation as fragment shader u may take a look here:

http://machinesdontcare.wordpress.com/2007/12/29/polarpixellate-glsl/
Reply | Threaded
Open this post in threaded view
|

Re: Mapping a texture

AlexRNL
Demoscene Passivist wrote
Yes, u could definetly do that with OpenGL.

I would suggest using "OpenGL Shading Language" (GLSL) for the tranformation u wanna do. OpenGL shaders really fast and could easily handle ur problem in realtime.

To get an idea of how to do the "cartesian to polar" and "polar to cartesian" transformation as fragment shader u may take a look here:

http://machinesdontcare.wordpress.com/2007/12/29/polarpixellate-glsl/
Thanks a lot, I managed to realize the operation quite easily (in comparison with what i was thinking of doing) :)

(And sorry for the image's size, I didn't realize how big it would be...)