render()
functionrender()
call
requestAnimationFrame()
render()
as the function to be called
render()
from render()
—
recursionfunction render() {
gl.clear(gl.COLOR_BUFFER_BIT);
gl.useProgram(program);
angle += 3.0; // rotate three degrees each frame
angle %= 360.0;
gl.uniform1f(uAngle, angle);
gl.drawArrays(gl.TRIANGLES, 0, 3);
requestAnimationFrame(render);
}