Trait glitter::vertex_buffer::ContextVertexBufferExt [] [src]

pub trait ContextVertexBufferExt: AContext {
    fn new_vertex_buffer<V: VertexData>(&self) -> VertexBuffer<V> { ... }
    fn buffer_vertices<T>(&self, gl_vbo: &mut VertexBufferBinding<T>, vertices: &[T], usage: BufferDataUsage) where T: VertexData, [T]: VertexBytes { ... }
    fn buffer_indices<T>(&self, gl_ibo: &mut IndexBufferBinding<T>, indices: &[T], usage: BufferDataUsage) where T: IndexDatum, [T]: IndexData { ... }
    fn draw_arrays_range_vbo<V>(&self, gl_vbo: &VertexBufferBinding<V>, mode: DrawingMode, start: u32, length: usize) where V: VertexData { ... }
    fn draw_arrays_vbo<V>(&self, gl_vbo: &VertexBufferBinding<V>, mode: DrawingMode) where V: VertexData { ... }
    fn draw_n_elements_buffered_vbo<V, I>(&self, gl_vbo: &VertexBufferBinding<V>, gl_ibo: &IndexBufferBinding<I>, mode: DrawingMode, length: usize) where V: VertexData, I: IndexDatum { ... }
    fn draw_elements_buffered_vbo<V, I>(&self, gl_vbo: &VertexBufferBinding<V>, gl_ibo: &IndexBufferBinding<I>, mode: DrawingMode) where V: VertexData, I: IndexDatum { ... }
    fn draw_n_elements_vbo<V, I>(&self, gl_vbo: &VertexBufferBinding<V>, mode: DrawingMode, count: usize, indices: &[I]) where V: VertexData, I: IndexDatum, [I]: IndexData { ... }
    fn draw_elements_vbo<V, I>(&mut self, gl_vbo: &VertexBufferBinding<V>, mode: DrawingMode, indices: &[I]) where V: VertexData, I: IndexDatum, [I]: IndexData { ... }
}

An extension trait that adds vertex buffer and index buffer-related methods to OpenGL contexts.

Provided Methods

fn new_vertex_buffer<V: VertexData>(&self) -> VertexBuffer<V>

Create a new, empty vertex buffer.

fn buffer_vertices<T>(&self, gl_vbo: &mut VertexBufferBinding<T>, vertices: &[T], usage: BufferDataUsage) where T: VertexData, [T]: VertexBytes

Send data to a vertex buffer. Note that this will replace the buffer's current contents, if any.

fn buffer_indices<T>(&self, gl_ibo: &mut IndexBufferBinding<T>, indices: &[T], usage: BufferDataUsage) where T: IndexDatum, [T]: IndexData

Send data to an index buffer. Note that this will replace the buffer's current contents, if any.

fn draw_arrays_range_vbo<V>(&self, gl_vbo: &VertexBufferBinding<V>, mode: DrawingMode, start: u32, length: usize) where V: VertexData

Use the data from the provided vertex buffer binding to render primitives.

  • gl_vbo: The binding of the vertex buffer to read vertices from.
  • mode: The type of primitives to draw.
  • start: The index of the first vertex to draw.
  • length: The number of vertices to draw.

Panics

This function will panic if the start and length are out of bounds of the currently-buffered data.

fn draw_arrays_vbo<V>(&self, gl_vbo: &VertexBufferBinding<V>, mode: DrawingMode) where V: VertexData

Use the data from the provided vertex buffer binding to render primitives. This function will use the full range of vertices that have been buffered.

  • gl_vbo: The binding of the vertex buffer to read vertices from.
  • mode: The type of primitives to draw.

fn draw_n_elements_buffered_vbo<V, I>(&self, gl_vbo: &VertexBufferBinding<V>, gl_ibo: &IndexBufferBinding<I>, mode: DrawingMode, length: usize) where V: VertexData, I: IndexDatum

Draw primitives using the provided index buffer as the indices into the provided vertex buffer.

  • gl_vbo: The binding of the buffer that contains the vertex data.
  • gl_ibo: The binding of the buffer that contains the index data.
  • mode: The type of primitives to draw.
  • length: The number of indices to read.

fn draw_elements_buffered_vbo<V, I>(&self, gl_vbo: &VertexBufferBinding<V>, gl_ibo: &IndexBufferBinding<I>, mode: DrawingMode) where V: VertexData, I: IndexDatum

Draw primitives using the provided index buffer as the indices into the provided vertex buffer. All buffered indices will be used.

  • gl_vbo: The binding of the buffer that contains the vertex data.
  • gl_ibo: The binding of the buffer that contains the index data.
  • mode: The type of primitives to draw.

fn draw_n_elements_vbo<V, I>(&self, gl_vbo: &VertexBufferBinding<V>, mode: DrawingMode, count: usize, indices: &[I]) where V: VertexData, I: IndexDatum, [I]: IndexData

Draw primitives speicified by the provided index array, treated as indices into the provided vertex buffer.

  • gl_vbo: The binding of the buffer that contains the vertex data.
  • mode: The type of primitives to draw.
  • count: The number of indices to read.
  • indices: The index array to use.

fn draw_elements_vbo<V, I>(&mut self, gl_vbo: &VertexBufferBinding<V>, mode: DrawingMode, indices: &[I]) where V: VertexData, I: IndexDatum, [I]: IndexData

Draw primitives speicified by the provided index array, treated as indices into the provided vertex buffer.

  • gl_vbo: The binding of the buffer that contains the vertex data.
  • mode: The type of primitives to draw.
  • indices: The index array to use.

Implementors