function compileShader(vert, frag){
	var vs = gl.createShader(gl.VERTEX_SHADER);
	gl.shaderSource(vs, vert);
	gl.compileShader(vs);
	if (!gl.getShaderParameter(vs, gl.COMPILE_STATUS)){
		alert("Vertex shader failed to compile, see console for log");
		console.log(gl.getShaderInfoLog(vs));
		return null;
	}

	var fs = gl.createShader(gl.FRAGMENT_SHADER);
	gl.shaderSource(fs, frag);
	gl.compileShader(fs);
	if (!gl.getShaderParameter(fs, gl.COMPILE_STATUS)){
		alert("Fragment shader failed to compile, see console for log");
		console.log(gl.getShaderInfoLog(fs));
		return null;
	}

	var program = gl.createProgram();
	gl.attachShader(program, vs);
	gl.attachShader(program, fs);
	gl.linkProgram(program);
	if (!gl.getProgramParameter(program, gl.LINK_STATUS)){
		alert("Shader failed to link, see console for log");
		console.log(gl.getProgramInfoLog(program));
		return null;
	}
	return program;
}
// Returns the compiled and linked program, or null if compilation or linking failed
Returns the compiled and linked program, or null if compilation or linking failed
Returns the compiled and linked program or null if compilation or linking failed
function compileShader(vert, frag){
	var vs = gl.createShader(gl.VERTEX_SHADER);
	gl.shaderSource(vs, vert);
	gl.compileShader(vs);
	if (!gl.getShaderParameter(vs, gl.COMPILE_STATUS)){
		alert("Vertex shader failed to compile, see console for log");
		console.log(gl.getShaderInfoLog(vs));
		return null;
	}
	var fs = gl.createShader(gl.FRAGMENT_SHADER);
	gl.shaderSource(fs, frag);
	gl.compileShader(fs);
	if (!gl.getShaderParameter(fs, gl.COMPILE_STATUS)){
		alert("Fragment shader failed to compile, see console for log");
		console.log(gl.getShaderInfoLog(fs));
		return null;
	}
	var program = gl.createProgram();
	gl.attachShader(program, vs);
	gl.attachShader(program, fs);
	gl.linkProgram(program);
	if (!gl.getProgramParameter(program, gl.LINK_STATUS)){
		alert("Shader failed to link, see console for log");
		console.log(gl.getProgramInfoLog(program));
		return null;
	}
	return program;
}
function compileShader ( vert , frag ) { var vs = gl . createShader ( gl . VERTEX_SHADER ) ; gl . shaderSource ( vs , vert ) ; gl . compileShader ( vs ) ; if ( ! gl . getShaderParameter ( vs , gl . COMPILE_STATUS ) ) { alert ( "Vertex shader failed to compile, see console for log" ) ; console . log ( gl . getShaderInfoLog ( vs ) ) ; return null ; } var fs = gl . createShader ( gl . FRAGMENT_SHADER ) ; gl . shaderSource ( fs , frag ) ; gl . compileShader ( fs ) ; if ( ! gl . getShaderParameter ( fs , gl . COMPILE_STATUS ) ) { alert ( "Fragment shader failed to compile, see console for log" ) ; console . log ( gl . getShaderInfoLog ( fs ) ) ; return null ; } var program = gl . createProgram ( ) ; gl . attachShader ( program , vs ) ; gl . attachShader ( program , fs ) ; gl . linkProgram ( program ) ; if ( ! gl . getProgramParameter ( program , gl . LINK_STATUS ) ) { alert ( "Shader failed to link, see console for log" ) ; console . log ( gl . getProgramInfoLog ( program ) ) ; return null ; } return program ; }
Returns the compiled and linked program, or null if compilation or linking failed
Returns the compiled and linked program or null if compilation or linking failed