delay
framerate:fps
Linear waves on 512×512 square.
2D wave equation
For the wave equation
∂t2u = Δu ,
u|t=0 = exp(-(r -
ro )2/ a2),
∂tu|t=0 = 0,
the simple explicit scheme
ux,yt+1 =
2ux,yt - ux,yt-1 +
(ux+1,yt + ux-1,yt +
ux,y+1t + ux,y-1t -
4ux,yt)(Δt/Δx)2 (*)
on square grid is used.
Simulations on GPU
To use calculated data many times (on every time step) we store them
in two float N×N textures (texture and texture1).
Every pixel corresponds to a lattice node.
We need only one component texture (i.e. LUMINANCE) but WebGL shader can render
to RGB or RGBA textures yet. To render the fragment shader output to these
textures they are bound to FBO and FBO1 correspondingly.
In accordance with (*) calculations are made in two steps:
texture + texture1 → FBO (texture) texture1 + texture → FBO1 (texture1) The first fragment shader makes the main calculations in accordance with (*).
All pixels are rendered into texture attached to one of FBOs