Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Modify a texture within a shader?

edited March 2013 in Shaders Posts: 24


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!


  • Posts: 455

    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
  • Posts: 24

    Thanks, I will give a try.

Sign In or Register to comment.