Modify a texture within a shader?

Hi,

I would like to store information computed by a shader in a texture and keep modifiying the texture over time in the shader ( texture will store a progressive deformation of the screen). Is it possible? Can you give me a quick sample?

Thanks for your help and many thanks to the Codea team for this great app!

This is doable, theres an example in http://twolivesleft.com/Codea/Talk/discussion/2252/game-of-life-shader

Basically, you can’t modify the texture directly, but you can setContext() to an image, then render your mesh in that context, then attach that as a texture to another mesh/shader etc…

This is my next project when I get time to try and do multipass for shadow mapping…

Conceptually it’s a bit like the following psuedo code, assume the meshes exist and have useful/sensible shaders

setup()
   pass1Texture = image(500,500)

draw()
   setContext(pass1Texture)
   mesh1:draw()

   --revert to normal context
   setContext()
   mesh2.texture = pass1Texture
   mesh2:draw()

Thanks, I will give a try.