allocate-buffer ( buffer size initial-data -- ) (original) (raw)

Vocabulary
gpu.buffers

Inputs

buffer a buffer
size an integer
initial-data a c-ptr or f

Outputs
None

Word description
Discards any memory currently held by buffer and reallocates a new memory block of size bytes for it. If initial-data is not f, size bytes are copied from initial-data into the buffer to initialize it; otherwise, the buffer content is left uninitialized.

See also
allocate-byte-array, buffer-size, update-buffer, read-buffer, copy-buffer, with-mapped-buffer

Definition

USING: gpu.buffers.private opengl.gl ;

IN: gpu.buffers

:: allocate-buffer ( buffer size initial-data -- )
buffer bind-buffer :> target target size initial-data buffer
gl-buffer-usage glBufferData ; inline