Struct tetra::graphics::mesh::VertexBuffer [−][src]
pub struct VertexBuffer { /* fields omitted */ }
Expand description
Vertex data, stored in GPU memory.
This data can be drawn to the screen via a Mesh
.
Performance
Creating a VertexBuffer
is a relatively expensive operation. If you can, store them in your
State
struct rather than recreating them each frame.
Cloning a VertexBuffer
is a very cheap operation, as the underlying data is shared between the
original instance and the clone via reference-counting.
This does mean, however, that updating a VertexBuffer
will also update any other clones of
that VertexBuffer
.
Implementations
impl VertexBuffer
[src]
impl VertexBuffer
[src]pub fn new(ctx: &mut Context, vertices: &[Vertex]) -> Result<VertexBuffer>
[src]
pub fn new(ctx: &mut Context, vertices: &[Vertex]) -> Result<VertexBuffer>
[src]Creates a new vertex buffer.
The buffer will be created with the BufferUsage::Dynamic
usage hint - this can
be overridden via the with_usage
constructor.
Errors
TetraError::PlatformError
will be returned if the underlying graphics API encounters an error.
pub fn with_usage(
ctx: &mut Context,
vertices: &[Vertex],
usage: BufferUsage
) -> Result<VertexBuffer>
[src]
pub fn with_usage(
ctx: &mut Context,
vertices: &[Vertex],
usage: BufferUsage
) -> Result<VertexBuffer>
[src]Creates a new vertex buffer, with the specified usage hint.
The GPU may optionally use the usage hint to optimize data storage and access.
Errors
TetraError::PlatformError
will be returned if the underlying graphics API encounters an error.
Trait Implementations
impl Clone for VertexBuffer
[src]
impl Clone for VertexBuffer
[src]fn clone(&self) -> VertexBuffer
[src]
fn clone(&self) -> VertexBuffer
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl Debug for VertexBuffer
[src]
impl Debug for VertexBuffer
[src]impl From<VertexBuffer> for Mesh
[src]
impl From<VertexBuffer> for Mesh
[src]fn from(buffer: VertexBuffer) -> Self
[src]
fn from(buffer: VertexBuffer) -> Self
[src]Performs the conversion.
impl PartialEq<VertexBuffer> for VertexBuffer
[src]
impl PartialEq<VertexBuffer> for VertexBuffer
[src]fn eq(&self, other: &VertexBuffer) -> bool
[src]
fn eq(&self, other: &VertexBuffer) -> bool
[src]This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &VertexBuffer) -> bool
[src]
fn ne(&self, other: &VertexBuffer) -> bool
[src]This method tests for !=
.
impl StructuralPartialEq for VertexBuffer
[src]
Auto Trait Implementations
impl !RefUnwindSafe for VertexBuffer
impl !Send for VertexBuffer
impl !Sync for VertexBuffer
impl Unpin for VertexBuffer
impl !UnwindSafe for VertexBuffer
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more