function createShader(gl, type, source) {
  const shader = gl.createShader(type);

  if (shader === null) {
    throw new Error('Shader compilation failed');
  }

  gl.shaderSource(shader, source);

  gl.compileShader(shader);
  if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
    const log = gl.getShaderInfoLog(shader);
    if (log === null) {
      throw new Error('Shader info log creation failed');
    }
    throw new Error(log);
  }

  return shader;
}
@param {WebGLRenderingContext} gl Rendering Context.
@param {GLenum} type Type of shader.
@param {string} source source of shader.
@return {WebGLShader} [progam] The program.