Struct rin::gl::Context[][src]

pub struct Context<'c, R = Screen> where
    R: 'c + RenderSurface
{ /* fields omitted */ }

Used to issue draw calls

Implementations

impl Context<'static, Screen>[src]

pub fn new<W>(window: &mut W) -> Result<Context<'static, Screen>, Error> where
    W: GlWindow
[src]

Create a new context from any window implementing GLWindow

pub fn from_properties<'a, P, W>(
    window: &mut W,
    properties: P
) -> Result<Context<'static, Screen>, Error> where
    P: IntoIterator<Item = &'a Property>,
    W: GlWindow
[src]

Create a new context from any window implmenting GLWindow and a set of default properties

impl<'c> Context<'c, Screen>[src]

pub unsafe fn reset_default_state(&mut self, state: State<'static>)[src]

Sets the current state to the one passed as parameter.

Used to reset the current state, for example, after altering it doing external gl calls

impl<'c, R> Context<'c, R> where
    R: 'c + RenderSurface
[src]

pub unsafe fn gl(&self) -> &Gl[src]

pub fn draw_with_properties<'a, V, U, I, P>(
    &self,
    vao_range: V,
    program: &Program,
    uniforms: I,
    properties: P
) -> Result<(), Error> where
    P: IntoIterator<Item = &'a Property>,
    V: VaoDraw,
    I: IntoIterator<Item = U>,
    U: Borrow<Uniform>, 
[src]

Draw the passed VaoDraw (VAO range + a mode)

The call will used the passed properties to set the GL state if it’s not the same already the passed glsl program and the set of uniforms

pub fn draw<V, U, I>(
    &self,
    vao_range: V,
    program: &Program,
    uniforms: I
) -> Result<(), Error> where
    V: VaoDraw,
    I: IntoIterator<Item = U>,
    U: Borrow<Uniform>, 
[src]

Draw the passed VaoDraw (VAO range + a mode)

The call will used the passed properties to set the GL state if it’s not the same already the passed glsl program and the set of uniforms

pub fn draw_instanced_with_opt_properties<'a, V, U, I, P>(
    &self,
    vao_range: V,
    num_instances: usize,
    program: &Program,
    uniforms: I,
    properties: Option<P>
) -> Result<(), Error> where
    P: IntoIterator<Item = &'a Property>,
    V: VaoDraw,
    I: IntoIterator<Item = U>,
    U: Borrow<Uniform>, 
[src]

Instanced drawing, draws num_instances times the passed VaoDraw (VAO range + a mode)

The call will used the passed properties to set the GL state if it’s not the same already the passed glsl program and the set of uniforms

pub fn draw_instanced<V, U, I>(
    &self,
    vao_range: V,
    num_instances: usize,
    program: &Program,
    uniforms: I
) -> Result<(), Error> where
    V: VaoDraw,
    I: IntoIterator<Item = U>,
    U: Borrow<Uniform>, 
[src]

Instanced drawing, draws num_instances times the passed VaoDraw (VAO range + a mode)

The call will used the passed properties to set the GL state if it’s not the same already the passed glsl program and the set of uniforms

pub fn draw_instanced_with_properties<'a, V, U, I, P>(
    &self,
    vao_range: V,
    num_instances: usize,
    program: &Program,
    uniforms: I,
    properties: P
) -> Result<(), Error> where
    P: IntoIterator<Item = &'a Property>,
    V: VaoDraw,
    I: IntoIterator<Item = U>,
    U: Borrow<Uniform>, 
[src]

Instanced drawing, draws num_instances times the passed VaoDraw (VAO range + a mode)

The call will used the passed properties to set the GL state if it’s not the same already the passed glsl program and the set of uniforms

pub fn draw_elements_command<V, T, B, U, I>(
    &self,
    vao_range: V,
    command_buffer: B,
    program: &Program,
    uniforms: I
) -> Result<(), Error> where
    B: BufferRange<T>,
    V: VaoDraw,
    I: IntoIterator<Item = U>,
    U: Borrow<Uniform>, 
[src]

Draw the passed VaoDraw (VAO range + a mode) using a draw command

The call will used the passed properties to set the GL state if it’s not the same already the passed glsl program and the set of uniforms

pub fn draw_arrays_command<V, T, U, I, B>(
    &self,
    vao_range: V,
    command_buffer: B,
    program: &Program,
    uniforms: I
) -> Result<(), Error> where
    B: BufferRange<T>,
    V: VaoDraw,
    I: IntoIterator<Item = U>,
    U: Borrow<Uniform>, 
[src]

Draw the passed VaoDraw (VAO range + a mode) using a draw command

The call will used the passed properties to set the GL state if it’s not the same already the passed glsl program and the set of uniforms

pub fn multi_draw_elements_command<V, T, B, U, I>(
    &self,
    vao_range: V,
    command_buffer: B,
    program: &Program,
    uniforms: I
) -> Result<(), Error> where
    B: BufferRange<T>,
    V: VaoDraw,
    I: IntoIterator<Item = U>,
    U: Borrow<Uniform>, 
[src]

Draw the passed VaoDraw (VAO range + a mode) using a draw command

The call will used the passed properties to set the GL state if it’s not the same already the passed glsl program and the set of uniforms

pub fn multi_draw_arrays_command<V, T, B, U, I>(
    &self,
    vao_range: V,
    command_buffer: B,
    program: &Program,
    uniforms: I
) -> Result<(), Error> where
    B: BufferRange<T>,
    V: VaoDraw,
    I: IntoIterator<Item = U>,
    U: Borrow<Uniform>, 
[src]

Draw the passed VaoDraw (VAO range + a mode) using a draw command

The call will used the passed properties to set the GL state if it’s not the same already the passed glsl program and the set of uniforms

pub unsafe fn multi_draw_elements_command_vao_id<T, B, U, I>(
    &self,
    vao_id: u32,
    mode: u32,
    command_buffer: B,
    program: &Program,
    uniforms: I
) -> Result<(), Error> where
    B: BufferRange<T>,
    I: IntoIterator<Item = U>,
    U: Borrow<Uniform>, 
[src]

Draw the passed VaoDraw (VAO range + a mode) using a draw command

The call will used the passed properties to set the GL state if it’s not the same already the passed glsl program and the set of uniforms

pub unsafe fn multi_draw_arrays_command_vao_id<T, B, U, I>(
    &self,
    vao_id: u32,
    mode: u32,
    command_buffer: B,
    program: &Program,
    uniforms: I
) -> Result<(), Error> where
    B: BufferRange<T>,
    I: IntoIterator<Item = U>,
    U: Borrow<Uniform>, 
[src]

Draw the passed VaoDraw (VAO range + a mode) using a draw command

The call will used the passed properties to set the GL state if it’s not the same already the passed glsl program and the set of uniforms

pub unsafe fn draw_with_program_id<V, U, I>(
    &self,
    vao_range: V,
    program: u32,
    uniforms: I
) -> Result<(), Error> where
    V: VaoDraw,
    I: IntoIterator<Item = U>,
    U: Borrow<Uniform>, 
[src]

Draw the passed VaoDraw (VAO range + a mode)

The call will use the passed properties to set the GL state if it’s not the same already the passed glsl program and the set of uniforms

pub unsafe fn draw_instanced_with_program_id<V, U, I>(
    &self,
    vao_range: V,
    num_instances: usize,
    program: u32,
    uniforms: I
) -> Result<(), Error> where
    V: VaoDraw,
    I: IntoIterator<Item = U>,
    U: Borrow<Uniform>, 
[src]

Instanced drawing, draws num_instances times the passed VaoDraw (VAO range + a mode)

The call will used the passed properties to set the GL state if it’s not the same already the passed glsl program and the set of uniforms

pub fn with<'a, P>(&self, properties: P) -> Context<'_, R> where
    P: IntoIterator<Item = &'a Property>, 
[src]

Pass a set of properties to get a copy of this context with those properties

Every draw call issued over the new context will use the passed properties.

use std::mem;
struct Vertex{
    position: [f32; 4]
}

let gl: glin::Context = unsafe{ mem::uninitialized() };
let vao: glin::SimpleVao<Vertex> = unsafe{ mem::uninitialized() };
let program: glin::Program = unsafe{ mem::uninitialized() };

{
    let gl = gl.with(&[glin::Property::DepthTest(true)]);
    // All calls in this scope will have depth testing enabled
    gl.draw(&vao, &program, &[]);
    gl.draw(&vao, &program, &[]);
    gl.draw(&vao, &program, &[]);
}

pub fn set_properties<'a, P>(&mut self, properties: P) where
    P: IntoIterator<Item = &'a Property>, 
[src]

pub fn with_fbo<F>(&self, fbo: F) -> Context<'_, F> where
    F: UntypedOffscreenBuffer + Clone
[src]

Pass an fbo get a copy of this context that renders to the fbo

This call is mut to forbid the caller from using the original context while the new one is in scoepe for performance reasons

struct Vertex {
    position: [f32; 4]
}

let fbo = gl.new_fbo().create(1920, 1080, glin::fbo::ColorFormat::RGBA8).unwrap();

{
    let gl = gl.with_fbo(&fbo);
    // All calls in this scope will render to the passed fbo
    gl.draw(&vao, &program, &[]);
    gl.draw(&vao, &program, &[]);
    gl.draw(&vao, &program, &[]);
}

pub fn into_with_fbo<F>(self, fbo: F) -> Context<'c, F> where
    F: UntypedOffscreenBuffer + Clone
[src]

pub fn capture_state(&self) -> State<'static>[src]

Get a copy of the context State

pub fn clear_color<C, T>(&self, color: &C) where
    C: Color<T> + ?Sized,
    T: ?Sized,
    Context<'c, R>: Sized
[src]

Clear the draw buffer with the passed color

pub fn clear_depth(&self, depth: f64)[src]

Clear the depth buffer

pub fn clear_stencil(&self, stencil: i32)[src]

Clear the stencil buffer

pub fn clear<C>(
    &self,
    color: Option<C>,
    depth: Option<f64>,
    stencil: Option<i32>
) where
    C: Borrow<[f32; 4]>, 
[src]

pub fn new_texture(&self) -> Builder<'_>[src]

pub fn new_cubemap(&self) -> Builder<'_>[src]

pub fn new_fbo(&self) -> Builder<'_>[src]

pub fn new_fbo_color_attachment(&self) -> ColorAttachmentBuilder<'_>[src]

pub fn new_fbo_depth_attachment(&self) -> DepthAttachmentBuilder<'_>[src]

pub fn new_render_buffer(&self) -> RenderBufferBuilder<'_>[src]

pub fn new_buffer(&self) -> Builder<'_>[src]

pub fn new_shared_buffer(&self) -> SharedBuilder<'_>[src]

pub fn new_vao(&self) -> Builder[src]

pub fn new_simple_vao(&self) -> Builder<'_>[src]

pub fn new_program(&self) -> Builder<'_>[src]

pub fn new_sampler(&self) -> Sampler[src]

pub fn new_timestamp_query(&self) -> TimeStamp[src]

pub fn new_duration_query(&self) -> Duration[src]

pub fn new_fence(&self) -> Fence[src]

pub fn new_debug_group(&self, id: u32, message: &str) -> DebugGroup[src]

pub fn creation_proxy(&self) -> &Rc<CreationProxy>[src]

pub fn state(&self) -> &State<'static>[src]

pub fn shallow_clone(&self) -> Context<'_, R>[src]

pub fn blit<C1, D1, C2, D2>(
    &self,
    fbo_src: &Fbo<C1, D1>,
    fbo_dst: &mut Fbo<C2, D2>,
    src_rect: &Rect,
    dst_rect: &Rect
)
[src]

Copy the contents of the first color attachment of this Fbo to dst

From the src_rect rectangle to dst_rect.

If scissor test is enabled in this context it’ll also modify the blited area

pub fn blit_color_attachment<C1, D1, C2, D2>(
    &self,
    fbo_src: &Fbo<C1, D1>,
    fbo_dst: &mut Fbo<C2, D2>,
    attachment: u32,
    src_rect: &Rect,
    dst_rect: &Rect
)
[src]

Copy the contents of the color specified attachment of this Fbo to dst

From the src_rect rectangle to dst_rect

If scissor test is enabled in this context it’ll also modify the blited area

pub fn blit_depth<C1, D1, C2, D2>(
    &self,
    fbo_src: &Fbo<C1, D1>,
    fbo_dst: &mut Fbo<C2, D2>,
    src_rect: &Rect,
    dst_rect: &Rect
)
[src]

Copy the contents of the depth attachments of this Fbo to dst

From the src_rect rectangle to dst_rect

If scissor test is enabled in this context it’ll also modify the blited area

pub fn dispatch_compute<U, I>(
    &self,
    program: &Program,
    x: u32,
    y: u32,
    z: u32,
    uniforms: I
) -> Result<(), Error> where
    I: IntoIterator<Item = U>,
    U: Borrow<Uniform>, 
[src]

impl<'c, R> Context<'c, R> where
    R: RenderSurface
[src]

pub fn surface(&self) -> &R[src]

Trait Implementations

impl<'c, R> Clone for Context<'c, R> where
    R: RenderSurface
[src]

impl<'c, R> CreationContext for Context<'c, R> where
    R: RenderSurface
[src]

impl<'c, R> CreationContextMut for Context<'c, R> where
    R: RenderSurface
[src]

impl<'c> SurfaceCreationContext for Context<'c, Screen>[src]

Auto Trait Implementations

impl<'c, R = Screen> !RefUnwindSafe for Context<'c, R>

impl<'c, R = Screen> !Send for Context<'c, R>

impl<'c, R = Screen> !Sync for Context<'c, R>

impl<'c, R> Unpin for Context<'c, R> where
    R: Unpin

impl<'c, R = Screen> !UnwindSafe for Context<'c, R>

Blanket Implementations

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

impl<T> Any for T where
    T: Any
[src]

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

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

impl<T> Downcast for T where
    T: Any
[src]

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

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

impl<V> IntoPnt<V> for V[src]

impl<V> IntoVec<V> for V[src]

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

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

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]