[][src]Struct glium::vertex::TransformFeedbackSession

pub struct TransformFeedbackSession<'a> { /* fields omitted */ }

Transform feedback allows you to obtain in a buffer the list of the vertices generated by the vertex shader, geometry shader, or tessellation evaluation shader of your program. This is usually used to cache the result in order to draw the vertices multiple times with multiple different fragment shaders.

To use transform feedback, you must create a transform feedback session. A transform feedback session mutably borrows the buffer where the data will be written. Each draw command submitted with a session will continue to append data after the data written by the previous draw command. You can only use the data when the session is destroyed.

Notes

Here are a few things to note if you aren't familiar with transform feedback:

Example

#[derive(Copy, Clone, Debug, PartialEq)]
struct Vertex {
    output_val: (f32, f32),
}

implement_vertex!(Vertex, output_val);

let mut out_buffer: glium::VertexBuffer<Vertex> = glium::VertexBuffer::empty(&display, 6).unwrap();

{
    let session = glium::vertex::TransformFeedbackSession::new(&display, &program,
                                                               &mut out_buffer).unwrap();

    let params = glium::DrawParameters {
        transform_feedback: Some(&session),
        .. Default::default()
    };

    display.draw().draw(&vb, &ib, &program, &uniform!{}, &params).unwrap();
}

let result: Vec<Vertex> = out_buffer.read().unwrap();
println!("List of generated vertices: {:?}", result);

Implementations

impl<'a> TransformFeedbackSession<'a>[src]

pub fn new<F: ?Sized, V>(
    facade: &F,
    program: &'a Program,
    buffer: &'a mut Buffer<[V]>
) -> Result<TransformFeedbackSession<'a>, TransformFeedbackSessionCreationError> where
    F: Facade,
    V: Vertex + Copy + Send + 'static, 
[src]

Builds a new transform feedback session.

TODO: this constructor should ultimately support passing multiple buffers of different types

Trait Implementations

impl<'a> Debug for TransformFeedbackSession<'a>[src]

impl<'a> Drop for TransformFeedbackSession<'a>[src]

Auto Trait Implementations

impl<'a> !RefUnwindSafe for TransformFeedbackSession<'a>

impl<'a> !Send for TransformFeedbackSession<'a>

impl<'a> !Sync for TransformFeedbackSession<'a>

impl<'a> Unpin for TransformFeedbackSession<'a>

impl<'a> !UnwindSafe for TransformFeedbackSession<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.