src/webgl/createProgramFromString.js
function createProgram (gl, vertexShader, fragmentShader) {

  // Create a program.
  const program = gl.createProgram();

  // Attach the shaders.
  gl.attachShader(program, vertexShader);
  gl.attachShader(program, fragmentShader);

  // Link the program.
  gl.linkProgram(program);

  // Check if it linked.
  const success = gl.getProgramParameter(program, gl.LINK_STATUS);

  if (!success && !gl.isContextLost()) {
    // Something went wrong with the link
    const infoLog = gl.getProgramInfoLog(program);

    console.error(`WebGL program filed to link:\n${infoLog}`);
  }

  return program;
}
function createProgram (gl, vertexShader, fragmentShader) {

  // Create a program.
  const program = gl.createProgram();

  // Attach the shaders.
  gl.attachShader(program, vertexShader);
  gl.attachShader(program, fragmentShader);

  // Link the program.
  gl.linkProgram(program);

  // Check if it linked.
  const success = gl.getProgramParameter(program, gl.LINK_STATUS);

  if (!success && !gl.isContextLost()) {
    // Something went wrong with the link
    const infoLog = gl.getProgramInfoLog(program);

    console.error(`WebGL program filed to link:\n${infoLog}`);
  }

  return program;
}
function createProgram ( gl , vertexShader , fragmentShader ) { // Create a program. const program = gl . createProgram ( ) ; // Attach the shaders. gl . attachShader ( program , vertexShader ) ; gl . attachShader ( program , fragmentShader ) ; // Link the program. gl . linkProgram ( program ) ; // Check if it linked. const success = gl . getProgramParameter ( program , gl . LINK_STATUS ) ; if ( ! success && ! gl . isContextLost ( ) ) { // Something went wrong with the link const infoLog = gl . getProgramInfoLog ( program ) ; console . error ( ` \n ${ infoLog } ` ) ; } return program ; }
Creates a program from 2 shaders.

@param {!WebGLRenderingContext} gl The WebGL context.
@param {!WebGLShader} vertexShader A vertex shader.
@param {!WebGLShader} fragmentShader A fragment shader.
@return {!WebGLProgram} A program.
@memberof WebGLRendering
Creates a program from 2 shaders .