Struct glium::IndexBuffer
[−]
[src]
pub struct IndexBuffer<T> where T: Index {
// some fields omitted
}A list of indices loaded in the graphics card's memory.
Methods
impl<T> IndexBuffer<T> where T: Index
fn new<F>(facade: &F, prim: PrimitiveType, data: &[T]) -> Result<IndexBuffer<T>, CreationError> where F: Facade
Builds a new index buffer from a list of indices and a primitive type.
fn dynamic<F>(facade: &F, prim: PrimitiveType, data: &[T]) -> Result<IndexBuffer<T>, CreationError> where F: Facade
Builds a new index buffer from a list of indices and a primitive type.
fn persistent<F>(facade: &F, prim: PrimitiveType, data: &[T]) -> Result<IndexBuffer<T>, CreationError> where F: Facade
Builds a new index buffer from a list of indices and a primitive type.
fn immutable<F>(facade: &F, prim: PrimitiveType, data: &[T]) -> Result<IndexBuffer<T>, CreationError> where F: Facade
Builds a new index buffer from a list of indices and a primitive type.
fn empty<F>(facade: &F, prim: PrimitiveType, len: usize) -> Result<IndexBuffer<T>, CreationError> where F: Facade
Builds a new empty index buffer.
fn empty_dynamic<F>(facade: &F, prim: PrimitiveType, len: usize) -> Result<IndexBuffer<T>, CreationError> where F: Facade
Builds a new empty index buffer.
fn empty_persistent<F>(facade: &F, prim: PrimitiveType, len: usize) -> Result<IndexBuffer<T>, CreationError> where F: Facade
Builds a new empty index buffer.
fn empty_immutable<F>(facade: &F, prim: PrimitiveType, len: usize) -> Result<IndexBuffer<T>, CreationError> where F: Facade
Builds a new empty index buffer.
fn get_primitives_type(&self) -> PrimitiveType
Returns the type of primitives associated with this index buffer.
fn get_indices_type(&self) -> IndexType
Returns the data type of the indices inside this index buffer.
fn slice(&self, range: Range<usize>) -> Option<IndexBufferSlice<T>>
Returns None if out of range.
Methods from Deref<Target=BufferView<[T]>>
fn new<F>(facade: &F, data: &T, ty: BufferType, mode: BufferMode) -> Result<BufferView<T>, BufferCreationError> where F: Facade
Builds a new buffer containing the given data. The size of the buffer is equal to the size of the data.
fn empty_unsized<F>(facade: &F, ty: BufferType, size: usize, mode: BufferMode) -> Result<BufferView<T>, BufferCreationError> where F: Facade
Builds a new buffer of the given size.
fn get_context(&self) -> &Rc<Context>
Returns the context corresponding to this buffer.
fn get_size(&self) -> usize
Returns the size in bytes of this buffer.
fn is_persistent(&self) -> bool
Returns true if this buffer uses persistent mapping.
fn write(&self, data: &T)
Uploads some data in this buffer.
Panic
Panics if the length of data is different from the length of this buffer.
fn invalidate(&self)
Invalidates the content of the buffer. The data becomes undefined.
You should call this if you only use parts of a buffer. For example if you want to use the first half of the buffer, you invalidate the whole buffer then write the first half.
This operation is a no-op if the backend doesn't support it.
fn read(&self) -> Result<T, ReadError>
Reads the content of the buffer.
fn map(&mut self) -> Mapping<T>
Maps the buffer in memory for both reading and writing.
fn map_read(&mut self) -> ReadMapping<T>
Maps the buffer in memory for reading.
fn map_write(&mut self) -> WriteMapping<T>
Maps the buffer in memory for writing only.
fn as_slice_any(&self) -> BufferViewAnySlice
Builds a slice-any containing the whole subbuffer.
fn empty<F>(facade: &F, ty: BufferType, mode: BufferMode) -> Result<BufferView<T>, BufferCreationError> where F: Facade
Builds a new buffer of the given size.
fn empty_array<F>(facade: &F, ty: BufferType, len: usize, mode: BufferMode) -> Result<BufferView<[T]>, BufferCreationError> where F: Facade
Builds a new buffer of the given size.
fn len(&self) -> usize
Returns the number of elements in this buffer.
fn slice(&self, range: Range<usize>) -> Option<BufferViewSlice<[T]>>
Builds a slice of this subbuffer. Returns None if out of range.
fn slice_mut(&mut self, range: Range<usize>) -> Option<BufferViewMutSlice<[T]>>
Builds a slice of this subbuffer. Returns None if out of range.
fn as_slice(&self) -> BufferViewSlice<[T]>
Builds a slice containing the whole subbuffer.
fn as_mut_slice(&mut self) -> BufferViewMutSlice<[T]>
Builds a slice containing the whole subbuffer.
fn read_as_texture_1d<S>(&self) -> Result<S, ReadError> where S: Texture1dDataSink<T>
Reads the content of the buffer.