[][src]Function mallumo_gls::raw::named_buffer_storage

pub unsafe fn named_buffer_storage<T, M>(
    id: BufferId,
    data: BufferData<T>,
    mutability: BufferMutability,
    map: M
) -> Result<(), Error> where
    M: Into<Option<BufferMap>>, 

Initializes buffer

Arguments

  • id - id of the buffer
  • data - enumeration, Empty(size) will allocate the size for the buffer, Data(&[T]) will initialize size of &[T] and copy data from slice to GPU memory
  • mutability - sets the mutability for the buffer. Beware, in OpenGL terminology immutable buffer means not resizable but all buffers created with glNamedBufferStorage are non-resizable. This simply says whether you can modify data in the buffer
  • map - whether to map the buffer for reading, writing, both or none

Example

let vertices: Vec<f32> = vec![-1.0, -1.0, 0.0, 1.0, -1.0, 0.0, 0.0, 1.0, 0.0];
let vertices_buffer = create_buffer();
named_buffer_storage(
    buffer,
    BufferData::Data(&vertices),
    BufferMutability:Immutable,
    None
);