Modify a texture within a shader?


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

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

   pass1Texture = image(500,500)


   --revert to normal context
   mesh2.texture = pass1Texture

Thanks, I will give a try.