function drawWithoutVAO() {
gl.clearColor(1., 1., 1., 1.);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
gl.useProgram(program1);
{
const numComponents = 2;
const type = gl.FLOAT;
const normalize = false;
const stride = 0;
const offset = 0;
gl.bindBuffer(gl.ARRAY_BUFFER, buffers1.position);
gl.vertexAttribPointer(
attributeLocations1.position,
numComponents,
type,
normalize,
stride,
offset);
gl.enableVertexAttribArray(attributeLocations1.position);
}
{
gl.uniform2f(uniformLocations1.resolution, width, height);
gl.uniform4fv(uniformLocations1.color, new Float32Array(data1.color));
gl.uniformMatrix4fv(uniformLocations1.transform, false, new Float32Array(transform));
}
{
const offset = 0;
const vertexCount = 3;
gl.drawArrays(gl.TRIANGLES, 0, 3)
}
gl.useProgram(program2);
{
{
const numComponents = 2;
const type = gl.FLOAT;
const normalize = false;
const stride = 0;
const offset = 0;
gl.bindBuffer(gl.ARRAY_BUFFER, buffers2.position);
gl.vertexAttribPointer(
attributeLocations2.position,
numComponents,
type,
normalize,
stride,
offset);
gl.enableVertexAttribArray(attributeLocations2.position);
}
{
const numComponents = 4;
const type = gl.FLOAT;
const normalize = false;
const stride = 0;
const offset = 0;
gl.bindBuffer(gl.ARRAY_BUFFER, buffers2.color);
gl.vertexAttribPointer(
attributeLocations2.color,
numComponents,
type,
normalize,
stride,
offset);
gl.enableVertexAttribArray(attributeLocations2.color);
}
}
{
gl.uniform2f(uniformLocations2.resolution, width, height);
gl.uniformMatrix4fv(uniformLocations2.transform, false, new Float32Array(transform));
}
{
const offset = 0;
const vertexCount = 3;
gl.drawArrays(gl.TRIANGLES, 0, 3)
}
}