Kaliber64
Kaliber64

Reputation: 594

Accumulation buffer alternatives

I'm using the accumulation buffer for motion trails and it works amazingly and super easy. Too bad ATI cards don't have this buffer. I need to be able to copy the color buffer reduce all its values and paste it in the next frame. What can I do? Are they called frame buffers?

Upvotes: 0

Views: 246

Answers (1)

joeld
joeld

Reputation: 32924

Use a framebuffer object and a screen-sized texture (or next largest power of 2). bind the framebuffer object to the texture and draw your scene. Then, bind the default framebuffer and draw a black card with some faint opacity (to dim the previous frames) and then draw the texture as a full screen quad with a blend func of GL_ONE, GL_ONE. Don't clear the screen between frames.

This gets a little more complicated with double buffering. You might have to use two or three textures (one for the scene, one or two for the accumulated state instead of just using the default framebuffer).

It's a bit more complicated, but on the plus side, you can do lots of effects like blurring the trails or other 2d-post processing once you have this set up.

Here's some specifics about the render-to-texture calls:

http://ogltotd.blogspot.com/2006/12/render-to-texture.html

Upvotes: 1

Related Questions