Reputation: 40719
I add a new object to the webgl buffer with this code:
triangleVertexPositionBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, triangleVertexPositionBuffer);
var vertices = [
0.0, 1.0, 0.0,
-1.0, -1.0, 0.0,
1.0, -1.0, 0.0
];
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);
It works, but I don't know, how to remove this object from the buffer.
Upvotes: 3
Views: 1188
Reputation: 473322
glBufferData
does not put objects in a buffer. It allocates storage of the size you request and copies the data from the buffer you give it into the buffer object's internal data storage. So there's no "removing" of the object later; it's just copying it.
Upvotes: 2