function render() {

  // Increment theta if rotating.
  theta += (isRotating) ? 0.01 : 0;

  // Increment displacement values.
  x += xStep*stepScale;
  y += yStep*stepScale;

  // Matrix to represent a clockwise rotation and a translation to x and y.
  var matrix = [Math.cos(theta), -Math.sin(theta), 0.0,Math.sin(theta), Math.cos(theta), 0.0,x, y, 0.0];

  // Set the uniform matrix.
  var matrixLoc = gl.getUniformLocation(shaderProgram, "M");
  gl.uniformMatrix3fv(matrixLoc, false, matrix);

  // Draw buffer.
  gl.clear( gl.COLOR_BUFFER_BIT );
  gl.drawArrays( gl.TRIANGLE_FAN, 0, arrayOfVertices.length);
}
/* Draws buffer contents to the screen and calculates vertex transformations. */
Draws buffer contents to the screen and calculates vertex transformations.
Draws buffer contents to the screen and calculates vertex transformations .
function render() {
  theta += (isRotating) ? 0.01 : 0;
  x += xStep*stepScale;
  y += yStep*stepScale;
  var matrix = [Math.cos(theta), -Math.sin(theta), 0.0,Math.sin(theta), Math.cos(theta), 0.0,x, y, 0.0];
  var matrixLoc = gl.getUniformLocation(shaderProgram, "M");
  gl.uniformMatrix3fv(matrixLoc, false, matrix);
  gl.clear( gl.COLOR_BUFFER_BIT );
  gl.drawArrays( gl.TRIANGLE_FAN, 0, arrayOfVertices.length);
}
function render ( ) { theta += ( isRotating ) ? 0.01 : 0 ; x += xStep * stepScale ; y += yStep * stepScale ; var matrix = [ Math . cos ( theta ) , - Math . sin ( theta ) , 0.0 , Math . sin ( theta ) , Math . cos ( theta ) , 0.0 , x , y , 0.0 ] ; var matrixLoc = gl . getUniformLocation ( shaderProgram , "M" ) ; gl . uniformMatrix3fv ( matrixLoc , false , matrix ) ; gl . clear ( gl . COLOR_BUFFER_BIT ) ; gl . drawArrays ( gl . TRIANGLE_FAN , 0 , arrayOfVertices . length ) ; }
Draws buffer contents to the screen and calculates vertex transformations.
Draws buffer contents to the screen and calculates vertex transformations .
// Increment theta if rotating. // Increment displacement values. // Matrix to represent a clockwise rotation and a translation to x and y. // Set the uniform matrix. // Draw buffer.