Struct glin::Context[][src]

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

Used to issue draw calls

Methods

impl Context<'static>
[src]

Create a new context from any window implementing GLWindow

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

impl<'c, R: RenderSurface + 'c> Context<'c, R>
[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

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

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

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

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, &[]);
}

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

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 fbo = gl.new_fbo().create(1920, 1080).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, &[]);
}

Get a copy of the context State

Clear the draw buffer with the passed color

Clear the depth buffer

Clear the stencil buffer

Trait Implementations

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

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

Auto Trait Implementations

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

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