`#version 300 es // an attribute is an input (in) to a vertex shader. // It will receive data from a buffer in vec2 aVertexPosition; //a_position; //in vec4 aVertexPosition; //a_position; // Used to pass in the resolution of the canvas uniform vec2 uResolution; // translation to add to position uniform vec2 uTranslation; // rotation to add to position uniform vec2 uRotation; uniform vec2 uScale; // all shaders have a main function void main() { // Scale the position vec2 scaledPosition = aVertexPosition * uScale; // Rotate the position vec2 rotatedPosition = vec2( scaledPosition.x * uRotation.y + scaledPosition.y * uRotation.x, scaledPosition.y * uRotation.y - scaledPosition.x * uRotation.x ); // Add in the translation // vec2 position = aVertexPosition + uTranslation; vec2 position = rotatedPosition + uTranslation; // convert the position from pixels to 0.0 to 1.0 // vec2 zeroToOne = aVertexPosition /vec2(2.0 , 2.0 ) ; // vec2 zeroToOne = aVertexPosition / uResolution ; // vec2 zeroToOne = position / uResolution ; // // convert from 0->1 to 0->2 vec2 zeroToTwo = zeroToOne * 2.0; // convert from 0->2 to -1->+1 (clipspace) vec2 clipSpace = zeroToTwo - 1.0; gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); }`