function compileShader(code, type) {
        var shader;
        if (type === 'fragment') {
            shader = gl.createShader(gl.FRAGMENT_SHADER);
        }
        else if (type === 'vertex') {
            shader = gl.createShader(gl.VERTEX_SHADER);
        }
        else {
            return null;
        }

        gl.shaderSource(shader, code);
        gl.compileShader(shader);
        
        if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
            console.log(gl.getShaderInfoLog(shader), 'Error: could not compile shaders');
            return null;
        }
        
        return shader;
    }
/**
     * Compiles an OpenGL shader from raw shader code.
     * @method  compileShader
     * @param  {String} code    The uncompiled shader program.
     * @param  {String} type    The type of shader to compiled (fragment or vertex).
     * @return {Object}         The compiled gl shader.
     */
Compiles an OpenGL shader from raw shader code.
@method  compileShader
@param  {String} code    The uncompiled shader program.
@param  {String} type    The type of shader to compiled (fragment or vertex).
@return {Object}         The compiled gl shader.
Compiles an OpenGL shader from raw shader code . @method compileShader @param { String } code The uncompiled shader program . @param { String } type The type of shader to compiled ( fragment or vertex ) . @return { Object } The compiled gl shader .
function compileShader(code, type) {
        var shader;
        if (type === 'fragment') {
            shader = gl.createShader(gl.FRAGMENT_SHADER);
        }
        else if (type === 'vertex') {
            shader = gl.createShader(gl.VERTEX_SHADER);
        }
        else {
            return null;
        }
        gl.shaderSource(shader, code);
        gl.compileShader(shader);
        if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
            console.log(gl.getShaderInfoLog(shader), 'Error: could not compile shaders');
            return null;
        }
        return shader;
    }
function compileShader ( code , type ) { var shader ; if ( type === 'fragment' ) { shader = gl . createShader ( gl . FRAGMENT_SHADER ) ; } else if ( type === 'vertex' ) { shader = gl . createShader ( gl . VERTEX_SHADER ) ; } else { return null ; } gl . shaderSource ( shader , code ) ; gl . compileShader ( shader ) ; if ( ! gl . getShaderParameter ( shader , gl . COMPILE_STATUS ) ) { console . log ( gl . getShaderInfoLog ( shader ) , 'Error: could not compile shaders' ) ; return null ; } return shader ; }
Compiles an OpenGL shader from raw shader code.
Compiles an OpenGL shader from raw shader code .