/// function main(){ const canvas = document.querySelector("canvas"); if(canvas === null){ console.error("couldn't find canvas"); return; } let gl = canvas.getContext("webgl2"); if(gl === null){ console.error("webgl2 is not supported!"); return; } const position = [ -0.5,-0.5, 0.0,0.5, 0.5,-0.5 ]; let positionBuffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER,positionBuffer); const floatPosition = new Float32Array(position); gl.bufferData(gl.ARRAY_BUFFER,floatPosition,gl.STATIC_DRAW); gl.drawArrays(gl.TRIANGLES,0,3); } main();