Rigid transformations from the fixed pipeline?

Hi all,

Within a research project, I am coding a physics engine for deformable bodies and visualization is made through OpenGL.

During the simulation, it may happen that vertexes of a given mesh are influenced by one or more rigid transformations (i.e., translations and rotations). For the simulation computation, I need the coordinates of vertexes in the world frame, so I explicitly set a transformation matrix and apply it to the vertex coordinates.

I wonder if OpenGL can do part of the work: I would like to set the transformation matrix with glLoadMatrix, send a vertex array on the gpu, transform and fetch back the results in the system memory.

I know that retrieving data from the gpu can be quite slow, however I would like to try because the number of the vertexes can be high and doing the computation entirely on the cpu may slow down the whole simulation.

Perhaps such a task could be performed directly in the fixed pipeline, without the need of any shader, but I am not sure of this. I would be very grateful if someone could share some hints (in case using shaders too).

thanks,
/Marco

Use a FBO with a RGBA32f texture as a render-target. A 2D RGBA32 texture will be your source (original vtx positions), uploaded via a PBO. Then with another PBO, you’ll copy things back to RAM.

http://www.gpgpu.org - for tutorials.

But with SSE and SOA (structure of arrays design) you can do this stuff possibly faster.

I see, thanks for your answer!

So, I could pack the vertex data and send them to the GPU via (maybe more than one) PBO. Then read back the data. Reading back from different PBO should be parallel and take not such a long time, I hope. Probably my main issue will be dealing with precision but I think I can handle it.

However your suggestion to use sse/soa is really interesting too. Do I need a special compiler to use it? do you know any resource (library / tutorial) where I can refer to?