dist/melonjs.js
function compileProgram(gl, vertex, fragment) {
       var vertShader = compileShader(gl, gl.VERTEX_SHADER, vertex);
       var fragShader = compileShader(gl, gl.FRAGMENT_SHADER, fragment);
       var program = gl.createProgram();
       gl.attachShader(program, vertShader);
       gl.attachShader(program, fragShader);
       gl.linkProgram(program);

       if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
         throw new Error("Error initializing Shader " + this + "\n" + "gl.VALIDATE_STATUS: " + gl.getProgramParameter(program, gl.VALIDATE_STATUS) + "\n" + "gl.getError()" + gl.getError() + "\n" + "gl.getProgramInfoLog()" + gl.getProgramInfoLog(program));
       }

       gl.useProgram(program); // clean-up

       gl.deleteShader(vertShader);
       gl.deleteShader(fragShader);
       return program;
     }
function compileProgram(gl, vertex, fragment) {
       var vertShader = compileShader(gl, gl.VERTEX_SHADER, vertex);
       var fragShader = compileShader(gl, gl.FRAGMENT_SHADER, fragment);
       var program = gl.createProgram();
       gl.attachShader(program, vertShader);
       gl.attachShader(program, fragShader);
       gl.linkProgram(program);

       if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
         throw new Error("Error initializing Shader " + this + "\n" + "gl.VALIDATE_STATUS: " + gl.getProgramParameter(program, gl.VALIDATE_STATUS) + "\n" + "gl.getError()" + gl.getError() + "\n" + "gl.getProgramInfoLog()" + gl.getProgramInfoLog(program));
       }

       gl.useProgram(program); // clean-up

       gl.deleteShader(vertShader);
       gl.deleteShader(fragShader);
       return program;
     }
function compileProgram ( gl , vertex , fragment ) { var vertShader = compileShader ( gl , gl . VERTEX_SHADER , vertex ) ; var fragShader = compileShader ( gl , gl . FRAGMENT_SHADER , fragment ) ; var program = gl . createProgram ( ) ; gl . attachShader ( program , vertShader ) ; gl . attachShader ( program , fragShader ) ; gl . linkProgram ( program ) ; if ( ! gl . getProgramParameter ( program , gl . LINK_STATUS ) ) { throw new Error ( "Error initializing Shader " + this + "\n" + "gl.VALIDATE_STATUS: " + gl . getProgramParameter ( program , gl . VALIDATE_STATUS ) + "\n" + "gl.getError()" + gl . getError ( ) + "\n" + "gl.getProgramInfoLog()" + gl . getProgramInfoLog ( program ) ) ; } gl . useProgram ( program ) ; // clean-up gl . deleteShader ( vertShader ) ; gl . deleteShader ( fragShader ) ; return program ; }
Compile GLSL into a shader object
@private
Compile GLSL into a shader object