GL.Buffer Class
A data buffer to be stored in the GPU
Constructor
GL.Buffer
-
target -
data -
spacing -
stream_type
Parameters:
-
targetNumbergl.ARRAY_BUFFER, ELEMENT_ARRAY_BUFFER
-
dataArrayBufferViewthe data in typed-array format
-
spacingNumbernumber of numbers per component (3 per vertex, 2 per uvs...), default 3
-
stream_typeEnumdefault gl.STATIC_DRAW (other: gl.DYNAMIC_DRAW, gl.STREAM_DRAW
Item Index
Methods
Methods
applyTransform
-
mat
Applies a mat4 transform to every triplets in the buffer (assuming they are points) No upload is performed (to ensure efficiency in case there are several operations performed)
Parameters:
-
matMat4
clone
-
share
Clones one buffer (it allows to share the same data between both buffers)
Parameters:
-
shareBooleanif you want that both buffers share the same data (default false) return {GL.Buffer} buffer cloned
delete
()
Deletes the content from the GPU and destroys the handler
forEach
-
callback
Applies an action to every vertex in this buffer
Parameters:
-
callbackFunctionto be called for every vertex (or whatever is contained in the buffer)
setData
-
data -
offset
Assign data to buffer and uploads it (it allows range)
Parameters:
-
dataArrayBufferViewin Float32Array format usually
-
offsetNumberoffset in bytes
upload
-
stream_type
Uploads the buffer data (stored in this.data) to the GPU
Parameters:
-
stream_typeNumberdefault gl.STATIC_DRAW (other: gl.DYNAMIC_DRAW, gl.STREAM_DRAW
uploadRange
-
start -
size
Uploads part of the buffer data (stored in this.data) to the GPU
Parameters:
-
startNumberoffset in bytes
-
sizeNumbersizes in bytes
