Struct opengl_graphics::GlGraphics [−] [src]

pub struct GlGraphics {
    // some fields omitted
}

Contains OpenGL data.

Methods

impl<'a> GlGraphics

fn new(opengl: OpenGL) -> Self

Creates a new OpenGL back-end.

Panics

If the OpenGL function pointers have not been loaded yet. See https://github.com/PistonDevelopers/opengl_graphics/issues/103 for more info.

fn viewport(&mut self, x: i32, y: i32, w: i32, h: i32)

Sets viewport with normalized coordinates and center as origin.

fn use_program(&mut self, program: GLuint)

Sets the current program only if the program is not in use.

fn clear_program(&mut self)

Unset the current program.

This forces the current program to be set on next drawing call.

fn draw<F>(&mut self, viewport: Viewport, f: F) where F: FnOnce(Context, &mut Self)

Draws graphics.

fn has_texture_alpha(&self, _texture: &Texture) -> bool

Assume all textures has alpha channel for now.

fn enable_alpha_blend(&mut self)

Enabled alpha blending.

fn disable_alpha_blend(&mut self)

Disables alpha blending.

Trait Implementations

impl Graphics for GlGraphics

type Texture = Texture

fn clear_color(&mut self, color: [f32; 4])

fn clear_stencil(&mut self, value: u8)

fn tri_list<F>(&mut self, _draw_state: &DrawState, color: &[f32; 4], f: F) where F: FnMut(&mut FnMut(&[f32]))

fn tri_list_uv<F>(&mut self, _draw_state: &DrawState, color: &[f32; 4], texture: &Texture, f: F) where F: FnMut(&mut FnMut(&[f32], &[f32]))