Skip to content

Instantly share code, notes, and snippets.

View ntmedina's full-sized avatar

Natália Medina ntmedina

View GitHub Profile
@raphamorim
raphamorim / webgl-init.js
Created May 15, 2016 22:58
WebGL Boilerplate
function createShaders(gl) {
var vertexShaderSrc = String(); // fill it with shader string or Script Text
var vertexShader = gl.createShader(gl.VERTEX_SHADER);
gl.shaderSource(vertexShader, vertexShaderSrc);
gl.compileShader(vertexShader);
var success = gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS);
if (!success) {
throw "could not compile shader:" + gl.getShaderInfoLog(vertexShader);
}