Initial transfer of larger repo from git. IF full history and branches are needed must go to github at https://github.com/DulcisL/CCUCoding.git
This commit is contained in:
commit
c09ce40be0
4048 files changed
+603256
No files matched your search
@@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
|
||||
var canvas;
|
||||
var gl;
|
||||
|
||||
var program;
|
||||
|
||||
var positionsArray = [];
|
||||
|
||||
|
||||
window.onload = function init() {
|
||||
canvas = document.getElementById("gl-canvas");
|
||||
|
||||
gl = canvas.getContext('webgl2');
|
||||
if(!gl) alert( "WebGL 2.0 isn't available");
|
||||
|
||||
gl.viewport(0, 0, canvas.width, canvas.height);
|
||||
gl.clearColor(1.0, 1.0, 1.0, 1.0);
|
||||
//
|
||||
// Load shaders and initialize attribute buffers
|
||||
//
|
||||
program = initShaders( gl, "vertex-shader", "fragment-shader" );
|
||||
gl.useProgram(program);
|
||||
|
||||
positionsArray.push(vec2(-1, -1));
|
||||
positionsArray.push(vec2(-1, 1));
|
||||
positionsArray.push(vec2(1, 1));
|
||||
positionsArray.push(vec2(1, -1));
|
||||
|
||||
|
||||
var vBuffer = gl.createBuffer();
|
||||
gl.bindBuffer( gl.ARRAY_BUFFER, vBuffer);
|
||||
gl.bufferData( gl.ARRAY_BUFFER, flatten(positionsArray), gl.STATIC_DRAW);
|
||||
|
||||
var positionLoc = gl.getAttribLocation( program, "aPosition");
|
||||
gl.vertexAttribPointer( positionLoc, 2, gl.FLOAT, false, 0, 0);
|
||||
gl.enableVertexAttribArray( positionLoc);
|
||||
|
||||
render();
|
||||
|
||||
}
|
||||
|
||||
|
||||
function render() {
|
||||
|
||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||
gl.drawArrays(gl.TRIANGLE_FAN, 0, 4);
|
||||
}
|
||||
Reference in new issue
Block a user