createIndexBuffer method

Buffer createIndexBuffer(
  1. OpenGLContextES gl,
  2. BufferAttribute bufferAttribute
)

Creates an index buffer.

Implementation

Buffer createIndexBuffer(OpenGLContextES gl, BufferAttribute bufferAttribute) {
  Buffer ibo = gl.createBuffer(); // ibo stands for Index Buffer Object.
  gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, ibo);
  gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, bufferAttribute.array, gl.STATIC_DRAW);
  return ibo;
}