vaoForInstancing = {
const vao = gl.createVertexArray()
gl.bindVertexArray(vao)
{
const numComponents = 2;
const type = gl.FLOAT;
const normalize = false;
const stride = 0;
const offset = 0;
gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer);
gl.vertexAttribPointer(
attributeLocationsForInstancing.position,
numComponents,
type,
normalize,
stride,
offset);
gl.enableVertexAttribArray(attributeLocationsForInstancing.position);
}
{
const numComponents = 4;
const type = gl.FLOAT;
const normalize = false;
const stride = 0;
const offset = 0;
gl.bindBuffer(gl.ARRAY_BUFFER, colorBuffer);
gl.vertexAttribPointer(
attributeLocationsForInstancing.color,
numComponents,
type,
normalize,
stride,
offset);
gl.enableVertexAttribArray(attributeLocationsForInstancing.color);
}
{
const numComponents = 2;
const type = gl.FLOAT;
const normalize = false;
const stride = 0;
const offset = 0;
gl.bindBuffer(gl.ARRAY_BUFFER, centerPosBuffer);
gl.vertexAttribPointer(
attributeLocationsForInstancing.centerPos,
numComponents,
type,
normalize,
stride,
offset);
gl.enableVertexAttribArray(attributeLocationsForInstancing.centerPos);
gl.vertexAttribDivisor(attributeLocationsForInstancing.centerPos, 1);
}
{
const numComponents = 1;
const type = gl.FLOAT;
const normalize = false;
const stride = 0;
const offset = 0;
gl.bindBuffer(gl.ARRAY_BUFFER, sizeBuffer);
gl.vertexAttribPointer(
attributeLocationsForInstancing.size,
numComponents,
type,
normalize,
stride,
offset);
gl.enableVertexAttribArray(attributeLocationsForInstancing.size);
gl.vertexAttribDivisor(attributeLocationsForInstancing.size, 1);
}
{
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, ebo)
}
return vao
}