Struct opengles_graphics::GlGraphics
source · pub struct GlGraphics { /* private fields */ }
Expand description
Contains OpenGL data.
Implementations§
source§impl<'a> GlGraphics
impl<'a> GlGraphics
sourcepub fn new(opengl: OpenGL) -> Self
pub 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.
sourcepub fn viewport(&mut self, x: i32, y: i32, w: i32, h: i32)
pub fn viewport(&mut self, x: i32, y: i32, w: i32, h: i32)
Sets viewport with normalized coordinates and center as origin.
sourcepub fn use_program(&mut self, program: GLuint)
pub fn use_program(&mut self, program: GLuint)
Sets the current program only if the program is not in use.
sourcepub fn clear_program(&mut self)
pub fn clear_program(&mut self)
Unset the current program.
This forces the current program to be set on next drawing call.
sourcepub fn use_draw_state(&mut self, draw_state: &DrawState)
pub fn use_draw_state(&mut self, draw_state: &DrawState)
Sets the current draw state, by detecting changes.
sourcepub fn clear_draw_state(&mut self)
pub fn clear_draw_state(&mut self)
Unsets the current draw state.
This forces the current draw state to be set on next drawing call.
sourcepub fn draw<F, U>(&mut self, viewport: Viewport, f: F) -> Uwhere
F: FnOnce(Context, &mut Self) -> U,
pub fn draw<F, U>(&mut self, viewport: Viewport, f: F) -> Uwhere
F: FnOnce(Context, &mut Self) -> U,
Draws graphics.
sourcepub fn has_texture_alpha(&self, _texture: &Texture) -> bool
pub fn has_texture_alpha(&self, _texture: &Texture) -> bool
Assume all textures has alpha channel for now.
Trait Implementations§
source§impl Graphics for GlGraphics
impl Graphics for GlGraphics
source§fn clear_stencil(&mut self, value: u8)
fn clear_stencil(&mut self, value: u8)
Clears stencil buffer with a value, usually 0. Read more
source§fn tri_list<F>(&mut self, draw_state: &DrawState, color: &[f32; 4], f: F)where
F: FnMut(&mut dyn FnMut(&[[f32; 2]])),
fn tri_list<F>(&mut self, draw_state: &DrawState, color: &[f32; 4], f: F)where
F: FnMut(&mut dyn FnMut(&[[f32; 2]])),
Renders list of 2d triangles using a solid color. Read more
source§fn tri_list_uv<F>(
&mut self,
draw_state: &DrawState,
color: &[f32; 4],
texture: &Texture,
f: F
)where
F: FnMut(&mut dyn FnMut(&[[f32; 2]], &[[f32; 2]])),
fn tri_list_uv<F>(
&mut self,
draw_state: &DrawState,
color: &[f32; 4],
texture: &Texture,
f: F
)where
F: FnMut(&mut dyn FnMut(&[[f32; 2]], &[[f32; 2]])),
Renders list of 2d triangles using a color and a texture. Read more
source§fn rectangle<R>(
&mut self,
r: &Rectangle,
rectangle: R,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
)where
R: Into<[f64; 4]>,
fn rectangle<R>(
&mut self,
r: &Rectangle,
rectangle: R,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
)where
R: Into<[f64; 4]>,
Draws a rectangle. Read more
source§fn polygon(
&mut self,
p: &Polygon,
polygon: &[[f64; 2]],
draw_state: &DrawState,
transform: [[f64; 3]; 2]
)
fn polygon(
&mut self,
p: &Polygon,
polygon: &[[f64; 2]],
draw_state: &DrawState,
transform: [[f64; 3]; 2]
)
Draws a polygon. Read more
source§fn polygon_tween_lerp(
&mut self,
p: &Polygon,
polygons: &[&[[f64; 2]]],
tween_factor: f64,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
)
fn polygon_tween_lerp(
&mut self,
p: &Polygon,
polygons: &[&[[f64; 2]]],
tween_factor: f64,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
)
Draws a tweened polygon using linear interpolation. Read more
source§fn image(
&mut self,
image: &Image,
texture: &Self::Texture,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
)
fn image(
&mut self,
image: &Image,
texture: &Self::Texture,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
)
Draws image. Read more
source§fn ellipse<R>(
&mut self,
e: &Ellipse,
rectangle: R,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
)where
R: Into<[f64; 4]>,
fn ellipse<R>(
&mut self,
e: &Ellipse,
rectangle: R,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
)where
R: Into<[f64; 4]>,
Draws ellipse. Read more
source§fn line<L>(
&mut self,
l: &Line,
line: L,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
)where
L: Into<[f64; 4]>,
fn line<L>(
&mut self,
l: &Line,
line: L,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
)where
L: Into<[f64; 4]>,
Draws line. Read more
source§fn circle_arc<R>(
&mut self,
c: &CircleArc,
rectangle: R,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
)where
R: Into<[f64; 4]>,
fn circle_arc<R>(
&mut self,
c: &CircleArc,
rectangle: R,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
)where
R: Into<[f64; 4]>,
Draws circle arc. Read more
source§fn deform_image(
&mut self,
d: &DeformGrid,
texture: &Self::Texture,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
)
fn deform_image(
&mut self,
d: &DeformGrid,
texture: &Self::Texture,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
)
Draws deformed image. Read more