src/Common/Misc/WebGl/index.js
function applyProgramDataMapping(
  gl,
  programName,
  mappingName,
  glConfig,
  glResources
) {
  const program = glResources.programs[programName];
  const mapping = glConfig.mappings[mappingName];

  mapping.forEach((bufferMapping) => {
    const glBuffer = glResources.buffers[bufferMapping.id];

    gl.bindBuffer(gl.ARRAY_BUFFER, glBuffer);
    program[bufferMapping.name] = gl.getAttribLocation(
      program,
      bufferMapping.attribute
    );
    gl.enableVertexAttribArray(program[bufferMapping.name]);
    gl.vertexAttribPointer(
      program[bufferMapping.name],
      ...bufferMapping.format
    );
    // FIXME: Remove this check when Apple fixes this bug
    /* global navigator */
    // const buggyBrowserVersion = ['AppleWebKit/602.1.50', 'AppleWebKit/602.2.14'];
    if (navigator.userAgent.indexOf('AppleWebKit/602') === -1) {
      gl.bindBuffer(gl.ARRAY_BUFFER, null);
    }
  });
}
function applyProgramDataMapping(
  gl,
  programName,
  mappingName,
  glConfig,
  glResources
) {
  const program = glResources.programs[programName];
  const mapping = glConfig.mappings[mappingName];

  mapping.forEach((bufferMapping) => {
    const glBuffer = glResources.buffers[bufferMapping.id];

    gl.bindBuffer(gl.ARRAY_BUFFER, glBuffer);
    program[bufferMapping.name] = gl.getAttribLocation(
      program,
      bufferMapping.attribute
    );
    gl.enableVertexAttribArray(program[bufferMapping.name]);
    gl.vertexAttribPointer(
      program[bufferMapping.name],
      ...bufferMapping.format
    );
    // FIXME: Remove this check when Apple fixes this bug
    /* global navigator */
    // const buggyBrowserVersion = ['AppleWebKit/602.1.50', 'AppleWebKit/602.2.14'];
    if (navigator.userAgent.indexOf('AppleWebKit/602') === -1) {
      gl.bindBuffer(gl.ARRAY_BUFFER, null);
    }
  });
}
function applyProgramDataMapping ( gl , programName , mappingName , glConfig , glResources ) { const program = glResources . programs [ programName ] ; const mapping = glConfig . mappings [ mappingName ] ; mapping . forEach ( ( bufferMapping ) => { const glBuffer = glResources . buffers [ bufferMapping . id ] ; gl . bindBuffer ( gl . ARRAY_BUFFER , glBuffer ) ; program [ bufferMapping . name ] = gl . getAttribLocation ( program , bufferMapping . attribute ) ; gl . enableVertexAttribArray ( program [ bufferMapping . name ] ) ; gl . vertexAttribPointer ( program [ bufferMapping . name ] , ... bufferMapping . format ) ; // FIXME: Remove this check when Apple fixes this bug /* global navigator */ // const buggyBrowserVersion = ['AppleWebKit/602.1.50', 'AppleWebKit/602.2.14']; if ( navigator . userAgent . indexOf ( 'AppleWebKit/602' ) === - 1 ) { gl . bindBuffer ( gl . ARRAY_BUFFER , null ) ; } } ) ; }
Apply new mapping to a program
Apply new mapping to a program