Struct opengl_graphics::GlGraphics [−][src]
Contains OpenGL data.
Implementations
impl GlGraphics
[src]
pub fn get_uniform<T: UniformType + ?Sized>(
&self,
name: &str
) -> Option<ShaderUniform<T>>
[src]
&self,
name: &str
) -> Option<ShaderUniform<T>>
Try to get uniform from the current shader of a given name.
impl<'a> GlGraphics
[src]
pub fn new(opengl: OpenGL) -> Self
[src]
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.
pub fn from_colored_textured(colored: Colored, textured: Textured) -> Self
[src]
Create a new OpenGL back-end with Colored
and Textured
structs to describe
how to render objects.
Panics
If the OpenGL function pointers have not been loaded yet. See https://github.com/PistonDevelopers/opengl_graphics/issues/103 for more info.
pub fn viewport(&mut self, x: i32, y: i32, w: i32, h: i32)
[src]
Sets viewport with normalized coordinates and center as origin.
pub fn get_current_program(&self) -> Option<GLuint>
[src]
Returns the current program
pub fn use_program(&mut self, program: GLuint)
[src]
Sets the current program only if the program is not in use.
pub fn clear_program(&mut self)
[src]
Unset the current program.
This forces the current program to be set on next drawing call.
pub fn use_draw_state(&mut self, draw_state: &DrawState)
[src]
Sets the current draw state, by detecting changes.
pub fn clear_draw_state(&mut self)
[src]
Unsets the current draw state.
This forces the current draw state to be set on next drawing call.
pub fn draw_begin(&mut self, viewport: Viewport) -> Context
[src]
Setup that should be called at the start of a frame’s draw call.
pub fn draw_end(&mut self)
[src]
Finalize the frame’s draw calls.
pub fn draw<F, U>(&mut self, viewport: Viewport, f: F) -> U where
F: FnOnce(Context, &mut Self) -> U,
[src]
F: FnOnce(Context, &mut Self) -> U,
Convenience for wrapping draw calls with the begin and end methods.
This is preferred over using the draw_begin & draw_end methods explicitly but may be less flexible.
pub fn has_texture_alpha(&self, _texture: &Texture) -> bool
[src]
Assume all textures has alpha channel for now.
Trait Implementations
impl Graphics for GlGraphics
[src]
type Texture = Texture
The texture type associated with the back-end. Read more
fn clear_color(&mut self, color: [f32; 4])
[src]
fn clear_stencil(&mut self, value: u8)
[src]
fn tri_list<F>(&mut self, draw_state: &DrawState, color: &[f32; 4], f: F) where
F: FnMut(&mut dyn FnMut(&[[f32; 2]])),
[src]
F: FnMut(&mut dyn FnMut(&[[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]])),
[src]
&mut self,
draw_state: &DrawState,
color: &[f32; 4],
texture: &Texture,
f: F
) where
F: FnMut(&mut dyn FnMut(&[[f32; 2]], &[[f32; 2]])),
pub fn rectangle<R>(
&mut self,
r: &Rectangle,
rectangle: R,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
) where
R: Into<[f64; 4]>,
[src]
&mut self,
r: &Rectangle,
rectangle: R,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
) where
R: Into<[f64; 4]>,
pub fn polygon(
&mut self,
p: &Polygon,
polygon: &[[f64; 2]],
draw_state: &DrawState,
transform: [[f64; 3]; 2]
)
[src]
&mut self,
p: &Polygon,
polygon: &[[f64; 2]],
draw_state: &DrawState,
transform: [[f64; 3]; 2]
)
pub fn polygon_tween_lerp(
&mut self,
p: &Polygon,
polygons: &[&[[f64; 2]]],
tween_factor: f64,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
)
[src]
&mut self,
p: &Polygon,
polygons: &[&[[f64; 2]]],
tween_factor: f64,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
)
pub fn image(
&mut self,
image: &Image,
texture: &Self::Texture,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
)
[src]
&mut self,
image: &Image,
texture: &Self::Texture,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
)
pub fn ellipse<R>(
&mut self,
e: &Ellipse,
rectangle: R,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
) where
R: Into<[f64; 4]>,
[src]
&mut self,
e: &Ellipse,
rectangle: R,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
) where
R: Into<[f64; 4]>,
pub fn line<L>(
&mut self,
l: &Line,
line: L,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
) where
L: Into<[f64; 4]>,
[src]
&mut self,
l: &Line,
line: L,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
) where
L: Into<[f64; 4]>,
pub fn circle_arc<R>(
&mut self,
c: &CircleArc,
rectangle: R,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
) where
R: Into<[f64; 4]>,
[src]
&mut self,
c: &CircleArc,
rectangle: R,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
) where
R: Into<[f64; 4]>,
pub fn deform_image(
&mut self,
d: &DeformGrid,
texture: &Self::Texture,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
)
[src]
&mut self,
d: &DeformGrid,
texture: &Self::Texture,
draw_state: &DrawState,
transform: [[f64; 3]; 2]
)
Auto Trait Implementations
impl RefUnwindSafe for GlGraphics
impl Send for GlGraphics
impl Sync for GlGraphics
impl Unpin for GlGraphics
impl UnwindSafe for GlGraphics
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
[src]
pub fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
[src]
T: Parameter<Self>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,