views:

106

answers:

1

I need a shader that starts with a given texture, then each frame of animation operates on the previous output of the shader plus other input.

How do I organize the framebuffers so that each frame has access to the output of the previous frame without having to move the buffer back and forth from the CPU?

+1  A: 

OpenGL ES 2.0 has Framebuffer Objects (FBOs), with it you can render directly into a texture, and you can use that texture as input for your next iteration.

That's the only way of doing it. Use two FBOs and two textures, each attached to each FBO. Read from one texture and write into the other, and then swap the textures, so you read from the last written, and write to the first. This is called "Ping-Pong" rendering.

Matias Valdenegro