cogl/auto/
index_buffer.rs

1use crate::{Context, Object};
2
3use glib::translate::*;
4use std::fmt;
5
6glib_wrapper! {
7    pub struct IndexBuffer(Object<ffi::CoglIndexBuffer, IndexBufferClass>) @extends Object;
8
9    match fn {
10        get_type => || ffi::cogl_index_buffer_get_gtype(),
11    }
12}
13
14impl IndexBuffer {
15    /// Declares a new `IndexBuffer` of `size` bytes to contain vertex
16    /// indices. Once declared, data can be set using
17    /// `cogl_buffer_set_data` or by mapping it into the application's
18    /// address space using `cogl_buffer_map`.
19    /// ## `context`
20    /// A `Context`
21    /// ## `bytes`
22    /// The number of bytes to allocate for vertex attribute data.
23    ///
24    /// # Returns
25    ///
26    /// A newly allocated `IndexBuffer`
27    pub fn new(context: &Context, bytes: usize) -> IndexBuffer {
28        unsafe { from_glib_full(ffi::cogl_index_buffer_new(context.to_glib_none().0, bytes)) }
29    }
30}
31
32impl fmt::Display for IndexBuffer {
33    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
34        write!(f, "IndexBuffer")
35    }
36}