src/programs.js
function bindUniformBlock(gl, programInfo, uniformBlockInfo) {
  const uniformBlockSpec = programInfo.uniformBlockSpec || programInfo;
  const blockSpec = uniformBlockSpec.blockSpecs[uniformBlockInfo.name];
  if (blockSpec) {
    const bufferBindIndex = blockSpec.index;
    gl.bindBufferRange(gl.UNIFORM_BUFFER, bufferBindIndex, uniformBlockInfo.buffer, uniformBlockInfo.offset || 0, uniformBlockInfo.array.byteLength);
    return true;
  }
  return false;
}
function bindUniformBlock(gl, programInfo, uniformBlockInfo) {
  const uniformBlockSpec = programInfo.uniformBlockSpec || programInfo;
  const blockSpec = uniformBlockSpec.blockSpecs[uniformBlockInfo.name];
  if (blockSpec) {
    const bufferBindIndex = blockSpec.index;
    gl.bindBufferRange(gl.UNIFORM_BUFFER, bufferBindIndex, uniformBlockInfo.buffer, uniformBlockInfo.offset || 0, uniformBlockInfo.array.byteLength);
    return true;
  }
  return false;
}
function bindUniformBlock ( gl , programInfo , uniformBlockInfo ) { const uniformBlockSpec = programInfo . uniformBlockSpec || programInfo ; const blockSpec = uniformBlockSpec . blockSpecs [ uniformBlockInfo . name ] ; if ( blockSpec ) { const bufferBindIndex = blockSpec . index ; gl . bindBufferRange ( gl . UNIFORM_BUFFER , bufferBindIndex , uniformBlockInfo . buffer , uniformBlockInfo . offset || 0 , uniformBlockInfo . array . byteLength ) ; return true ; } return false ; }
Binds a unform block to the matching uniform block point.
Matches by blocks by name so blocks must have the same name not just the same
structure.

If you have changed any values and you upload the valus into the corresponding WebGLBuffer
call {@link module:twgl.setUniformBlock} instead.

@param {WebGL2RenderingContext} gl A WebGL 2 rendering context.
@param {(module:twgl.ProgramInfo|module:twgl.UniformBlockSpec)} programInfo a `ProgramInfo`
as returned from {@link module:twgl.createProgramInfo} or or `UniformBlockSpec` as
returned from {@link module:twgl.createUniformBlockSpecFromProgram}.
@param {module:twgl.UniformBlockInfo} uniformBlockInfo a `UniformBlockInfo` as returned from
{@link module:twgl.createUniformBlockInfo}.
@return {bool} true if buffer was bound. If the programInfo has no block with the same block name
no buffer is bound.
@memberOf module:twgl/programs
Binds a unform block to the matching uniform block point . Matches by blocks by name so blocks must have the same name not just the same structure .