Create a WebGL program attached to the specified shaders. .createProgram(shaderArray)  shaderArray: Array of shaders to attach to program
493169
function createProgram(shaderArray) {
			var newProgram = glContext.createProgram();

			for (var shaderIndex = 0; shaderIndex < shaderArray.length; ++shaderIndex) {
					glContext.attachShader(newProgram, shaderArray[shaderIndex]);
			}
			glContext.linkProgram(newProgram);

			// Check for errors during linking
			var status = glContext.getProgramParameter(newProgram, glContext.LINK_STATUS);
			if (!status) {
					var infoLog = glContext.getProgramInfoLog(newProgram);
					console.log("Unable to link Kinect WebGL program. Error:" + infoLog);
					glContext.deleteProgram(newProgram);
					return null;
			}

			return newProgram;
	}
171941
function(shader) {
		var gl = this.gl;

		var offset = 0;
		var stride = this.vertexStride;

		//bind and update our vertex data before binding attributes
		this._updateBuffers();

		//for each attribtue
		for (var i=0; i<this._vertexAttribs.length; i++) {
			var a = this._vertexAttribs[i];

			//location of the attribute
			var loc = a.location === null 
					? shader.getAttributeLocation(a.name)
					: a.location;

			//TODO: We may want to skip unfound attribs
			// if (loc!==0 && !loc)
			// 	console.warn("WARN:", a.name, "is not enabled");

			//first, enable the vertex array
			gl.enableVertexAttribArray(loc);

			//then specify our vertex format
			gl.vertexAttribPointer(loc, a.numComponents, a.type || gl.FLOAT, 
								   a.normalize, stride, offset);

			//and increase the offset...
			offset += a.offsetCount * 4; //in bytes
		}
	}
322870
function createBufferFunc(fn) {
  return function(gl) {
    const arrays = fn.apply(this, Array.prototype.slice.call(arguments, 1));
    return attributes.createBuffersFromArrays(gl, arrays);
  };
}
1182459
function(options) {
    options = options || {};
    var canvas = document.createElement('canvas');
    canvas.width = 800;
    canvas.height = 600;
    if (!('alpha' in options)) options.alpha = false;
    try { gl = canvas.getContext('webgl', options); } catch (e) {}
    try { gl = gl || canvas.getContext('experimental-webgl', options); } catch (e) {}
    if (!gl) throw new Error('WebGL not supported');
    gl.HALF_FLOAT_OES = 0x8D61;
    addMatrixStack();
    addImmediateMode();
    addEventListeners();
    addOtherMethods();
    return gl;
  }
1282670
function buildShaderProgram(gl, name, config, resources) {
  const progConfig = config.programs[name];
  const compiledVertexShader = compileShader(
    gl,
    progConfig.vertexShader,
    gl.VERTEX_SHADER
  );
  const compiledFragmentShader = compileShader(
    gl,
    progConfig.fragmentShader,
    gl.FRAGMENT_SHADER
  );
  const program = createShaderProgram(gl, [
    compiledVertexShader,
    compiledFragmentShader,
  ]);

  // Store the created program in the resources
  resources.programs[name] = program;

  // Handle mapping if any
  if (progConfig.mapping) {
    applyProgramDataMapping(gl, name, progConfig.mapping, config, resources);
  }

  // Return program
  return program;
}
518715
public static int linkShaderProgram(GL2 gl, int[] shaders) throws ShaderCompilationException {
    int[] error = new int[1];
    int shaderprogram = gl.glCreateProgram();
    for(int shader : shaders) {
      gl.glAttachShader(shaderprogram, shader);
    }
    gl.glLinkProgram(shaderprogram);
    gl.glValidateProgram(shaderprogram);

    // This worked best for me to get error messages:
    gl.glGetObjectParameterivARB(shaderprogram, GL2.GL_OBJECT_INFO_LOG_LENGTH_ARB, error, 0);
    if(error[0] > 1) {
      byte[] info = new byte[error[0]];
      gl.glGetInfoLogARB(shaderprogram, info.length, error, 0, info, 0);
      String out = new String(info);
      gl.glDeleteProgram(shaderprogram);
      throw new ShaderCompilationException("Shader compilation error: " + out);
    }
    return shaderprogram;
  }
210845
function setupDepthRenderbuffer( renderTarget ) {

		var renderTargetProperties = properties.get( renderTarget );

		var isCube = ( renderTarget instanceof THREE.WebGLRenderTargetCube );

		if ( renderTarget.depthTexture ) {

			if ( isCube ) throw new Error('target.depthTexture not supported in Cube render targets');

			setupDepthTexture( renderTargetProperties.__webglFramebuffer, renderTarget );

		} else {

			if ( isCube ) {

				renderTargetProperties.__webglDepthbuffer = [];

				for ( var i = 0; i < 6; i ++ ) {

					_gl.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[ i ] );
					renderTargetProperties.__webglDepthbuffer[ i ] = _gl.createRenderbuffer();
					setupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer[ i ], renderTarget );

				}

			} else {

				_gl.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );
				renderTargetProperties.__webglDepthbuffer = _gl.createRenderbuffer();
				setupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer, renderTarget );

			}

		}

		_gl.bindFramebuffer( _gl.FRAMEBUFFER, null );

	}
215630
function ShaderAttribute(gl, program, location, dimension, name, constFunc, relink) {
  this._gl = gl
  this._program = program
  this._location = location
  this._dimension = dimension
  this._name = name
  this._constFunc = constFunc
  this._relink = relink
}
975400
def convert_shaders(convert, shaders):
    

    # New version of the shaders
    out = []

    if convert == 'es2':

        for isfragment, shader in enumerate(shaders):
            has_version = False
            has_prec_float = False
            has_prec_int = False
            lines = []
            # Iterate over lines
            for line in shader.lstrip().splitlines():
                if line.startswith('#version'):
                    has_version = True
                    continue
                if line.startswith('precision '):
                    has_prec_float = has_prec_float or 'float' in line
                    has_prec_int = has_prec_int or 'int' in line
                lines.append(line.rstrip())
            # Write
            # BUG: fails on WebGL (Chrome)
            # if True:
            #     lines.insert(has_version, '#line 0')
            if not has_prec_float:
                lines.insert(has_version, 'precision highp float;')
            if not has_prec_int:
                lines.insert(has_version, 'precision highp int;')
            # BUG: fails on WebGL (Chrome)
            # if not has_version:
            #     lines.insert(has_version, '#version 100')
            out.append('\n'.join(lines))

    elif convert == 'desktop':

        for isfragment, shader in enumerate(shaders):
            has_version = False
            lines = []
            # Iterate over lines
            for line in shader.lstrip().splitlines():
                has_version = has_version or line.startswith('#version')
                if line.startswith('precision '):
                    line = ''
                for prec in (' highp ', ' mediump ', ' lowp '):
                    line = line.replace(prec, ' ')
                lines.append(line.rstrip())
            # Write
            if not has_version:
                lines.insert(0, '#version 120\n')
            out.append('\n'.join(lines))

    else:
        raise ValueError('Cannot convert shaders to %r.' % convert)

    return tuple(out)
687333
def enable(z = nil)
      $window.gl z do
        raise ShaderError, "This shader already enabled." if enabled?
        current_shader = Gl.glGetIntegerv GL::GL_CURRENT_PROGRAM
        raise ShaderError, "Another shader already enabled." if current_shader > 0

        @previous_program = current_shader
        Gl.glUseProgram @program
      end

      result = nil

      if block_given?
        begin
          result = yield self
        ensure
          disable z
        end
      end

      result
    end
523812
function() {
    if( this.gl !== null ){
      this.gl.deleteProgram( this.program );
      this.gl.deleteShader(  this.fShader  );
      this.gl.deleteShader(  this.vShader  );
      this.gl = null;
    }
  }
339809
function (device, gl, cur, next) {
  let attrsDirty = false;

  // nothing changed for vertex buffer
  if (next.maxStream === -1) {
    console.warn('VertexBuffer not assigned, please call setVertexBuffer before every draw.');
    return;
  }

  if (cur.maxStream !== next.maxStream) {
    attrsDirty = true;
  } else if (cur.program !== next.program) {
    attrsDirty = true;
  } else {
    for (let i = 0; i < next.maxStream + 1; ++i) {
      if (
        cur.vertexBuffers[i] !== next.vertexBuffers[i] ||
        cur.vertexBufferOffsets[i] !== next.vertexBufferOffsets[i]
      ) {
        attrsDirty = true;
        break;
      }
    }
  }

  if (attrsDirty) {
    for (let i = 0; i < device._caps.maxVertexAttribs; ++i) {
      device._newAttributes[i] = 0;
    }

    for (let i = 0; i < next.maxStream + 1; ++i) {
      let vb = next.vertexBuffers[i];
      let vbOffset = next.vertexBufferOffsets[i];
      if (!vb) {
        continue;
      }

      gl.bindBuffer(gl.ARRAY_BUFFER, vb._glID);

      for (let j = 0; j < next.program._attributes.length; ++j) {
        let attr = next.program._attributes[j];

        let el = vb._format.element(attr.name);
        if (!el) {
          console.warn(`Can not find vertex attribute: ${attr.name}`);
          continue;
        }

        if (device._enabledAttributes[attr.location] === 0) {
          gl.enableVertexAttribArray(attr.location);
          device._enabledAttributes[attr.location] = 1;
        }
        device._newAttributes[attr.location] = 1;

        gl.vertexAttribPointer(
          attr.location,
          el.num,
          el.type,
          el.normalize,
          el.stride,
          el.offset + vbOffset * el.stride
        );
      }
    }

    // disable unused attributes
    for (let i = 0; i < device._caps.maxVertexAttribs; ++i) {
      if (device._enabledAttributes[i] !== device._newAttributes[i]) {
        gl.disableVertexAttribArray(i);
        device._enabledAttributes[i] = 0;
      }
    }
  }
}
286498
function reset() {
         this.sbIndex = 0;
         this.length = 0;
         var samplers = []; // WebGL context

         this.gl = this.renderer.gl;

         for (var i = 0; i < this.maxTextures; i++) {
           this.units[i] = false;
           samplers[i] = i;
         } // set the quad shader as the default program


         this.useShader(this.quadShader);
         this.quadShader.uniforms.uSampler = samplers;
       }
1065136
def set_shaders(self, vert, frag):
        
        if not vert or not frag:
            raise ValueError('Vertex and fragment code must both be non-empty')
        
        # pre-process shader code for #include directives
        vert, frag = preprocess(vert), preprocess(frag)
        
        # Store source code, send it to glir, parse the code for variables
        self._shaders = vert, frag

        self._glir.command('SHADERS', self._id, vert, frag)
        # All current variables become pending variables again
        for key, val in self._user_variables.items():
            self._pending_variables[key] = val
        self._user_variables = {}
        # Parse code (and process pending variables)
        self._parse_variables_from_code()
1047364
public void bind() {
        program.use();
        if (textures != null) {
            final TIntObjectIterator<Texture> iterator = textures.iterator();
            while (iterator.hasNext()) {
                iterator.advance();
                // Bind the texture to the unit
                final int unit = iterator.key();
                iterator.value().bind(unit);
                // Bind the shader sampler uniform to the unit
                program.bindSampler(unit);
            }
        }
    }
464335
private static int createShaders() throws IOException {

        // load and compile the vertex shader.
        String vertexShaderCode = IOUtils.toString(
                ClassLoader.getSystemResourceAsStream("vertexShader.glsl"));
        int vertexShaderId = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);
        glShaderSourceARB(vertexShaderId, vertexShaderCode);
        glCompileShaderARB(vertexShaderId);
        printLogInfo(vertexShaderId);

        // load and compile the fragment shader.
        String fragmentShaderCode = IOUtils.toString(
                ClassLoader.getSystemResourceAsStream("fragmentShader.glsl"));
        int fragmentShaderId = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
        glShaderSourceARB(fragmentShaderId, fragmentShaderCode);
        glCompileShaderARB(fragmentShaderId);
        printLogInfo(fragmentShaderId);

        // combine the two into a program.
        int programId = ARBShaderObjects.glCreateProgramObjectARB();
        glAttachObjectARB(programId, vertexShaderId);
        glAttachObjectARB(programId, fragmentShaderId);
        glValidateProgramARB(programId);
        glLinkProgramARB(programId);
        printLogInfo(programId);

        return programId;
    }
142162
function(cam, shader, assembly) {
    var gens = assembly.generators();
    for (var i = 0; i < gens.length; ++i) {
      var gen = gens[i];
      var affectedVAs = this._vertArraysInvolving(gen.chains());
      this._drawVertArrays(cam, shader, affectedVAs, gen.matrices());
    }
  }