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).

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.

kehziah

07-20-2004, 03:39 PM

Not too sure I undestand your concern. If it is the fact that you have to call a method each frame and do an explicit name swap, maybe the following could be what you look for.

If you have a frame counter, you could base the target buffer ID on the even/odd-ness of the counter.Something like :
posBufferID = (frmCount%2)?ID1:ID2;
oldPosBufferID = (frmCount%2)?ID2:ID1;
This way names are automatically exchanged each frame without the need of a special call.

Obli

07-23-2004, 03:08 AM

Originally posted by kehziah:
Not too sure I undestand your concern. If it is the fact that you have to call a method each frame and do an explicit name swap, maybe the following could be what you look for.No. The problem is not to implement it. I could do it pretty easily. The problem is to fit it in the current vertex processing API (which shows only some GL characteristics). Before putting in the Swap call, I'd like to be sure this is The Right Way to solve the problem. It looks hack-ish and way too much specific considering the rest of the API is very generic.

Originally posted by kehziah:
If you have a frame counter...It's unlikely I'll ever have one. While I could put it in for the purpose (I would anyway a day), I don't really like it.

Originally posted by kehziah:
you could base the target buffer ID on the even/odd-ness of the counter.Something like :
posBufferID = (frmCount%2)?ID1:ID2;
oldPosBufferID = (frmCount%2)?ID2:ID1;Besides the fact I don't understand why I have to do that while I could just swap the two as I always do with other vars, there are some problems.
The problem is that the buffer IDs are not accessible. At most, I could work on that, but it won't look usable in the long run.

Originally posted by kehziah:
This way names are automatically exchanged each frame without the need of a special call.Possibly, but having to repeat this each time I have to do a swap is exactly why function call are here. Even if I could swap that way, it would still be rather boring to manage.

Thank you for the post. At least, someone tryed. Also, since GL is not really involved in this, maybe I'll post this is math & algos...