I'd like to use a single bitmap to store the state of a 2D dynamical system which evolves over time according to some rules. Think of it as a grayscale image where the brightness of each pixel represents the temperature of each point on a rectangular plate at time t, call this T(t). And I have a function that will give me the temperature at each point at time t + 1 as a function of this; so T(t+1) = f(T(t)). Or if you prefer the pixels represent the height of the surface of water at each point and the function is calculating how waves on the water evolve over time.
Anyway my thinking is that it should be possible to do all of this in a GLSL shader, as long as the results of the previous shader pass at time t are available to the shader on the next frame, i.e. at time t + 1.
So far pretty much every basic example I can find (and I'm a real beginner to shaders so maybe I just need to find some not so basic examples) seems to be kind of a one-way street; the shader's output (color at each point) can be a function of time and of the existing texture but not of it's own previous output.
Am I missing something?
I'm specifically trying to implement something on iOS using SpriteKit which allows for GLSL shaders but I'd imagine that pointers to something like this in other languages/platforms would still be useful.