Obli
07-20-2004, 05:18 AM
I have implemented various render paths in my project. Actually, I always run using ARB_VBO and EXT_multi_draw_arrays, so I'll keep the question focused on that thing.
I actually have the need to save the content of an array so, vertex positions from frame n are saved and passed as special attribute to rendering in frame n+1.
After all, I am thinking about a simple buffer swap. I.E. swap the two buffer IDs and you're done.
I wonder however, if there are other viable methods to do that because this approach doesn't fit very nicely in my internal API (it looks like a fast hack).
Here's how it works.
Frame0
Compute positions.
Set oldPositions to positions.
Frame1
Move positions to oldPositions.
Update positions.
Frame2
Move positions to oldPositions.
Update positions.
Easy, isn't it?
The problem is that a call like SwapBuffers(attrib0, attrib1) does not look really nice to me.
Thank you for your collaboration, I won't hide the fact I'm short on ideas to solve that. It's mainly a stilistic problem.
I actually have the need to save the content of an array so, vertex positions from frame n are saved and passed as special attribute to rendering in frame n+1.
After all, I am thinking about a simple buffer swap. I.E. swap the two buffer IDs and you're done.
I wonder however, if there are other viable methods to do that because this approach doesn't fit very nicely in my internal API (it looks like a fast hack).
Here's how it works.
Frame0
Compute positions.
Set oldPositions to positions.
Frame1
Move positions to oldPositions.
Update positions.
Frame2
Move positions to oldPositions.
Update positions.
Easy, isn't it?
The problem is that a call like SwapBuffers(attrib0, attrib1) does not look really nice to me.
Thank you for your collaboration, I won't hide the fact I'm short on ideas to solve that. It's mainly a stilistic problem.