createBufferFromBufferAttribute method

Buffer createBufferFromBufferAttribute(
  1. OpenGLContextES gl,
  2. BufferAttribute bufferAttribute,
  3. int drawType
)

The drawType can be:

  • ARRAY_BUFFER
  • gl.ELEMENT_ARRAY_BUFFER

Info about the buffer

Basicaly a buffer is an array.

Implementation

Buffer createBufferFromBufferAttribute(OpenGLContextES gl, BufferAttribute bufferAttribute, int drawType) {
  Buffer buffer = gl.createBuffer();
  gl.bindBuffer(drawType, buffer);
  gl.bufferData(drawType, bufferAttribute.array, gl.STATIC_DRAW);
  return buffer;
}