pub struct GlGraphics { /* private fields */ }
Expand description
Contains OpenGL data.
Implementations§
Source§impl GlGraphics
impl GlGraphics
Sourcepub fn get_uniform<T: UniformType + ?Sized>(
&self,
name: &str,
) -> Option<ShaderUniform<T>>
pub fn get_uniform<T: UniformType + ?Sized>( &self, name: &str, ) -> Option<ShaderUniform<T>>
Try to get uniform from the current shader of a given name.
Source§impl GlGraphics
impl 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 from_pieces(
colored: Colored,
textured: Textured,
textured_color: TexturedColor,
) -> Self
pub fn from_pieces( colored: Colored, textured: Textured, textured_color: TexturedColor, ) -> Self
Create a new OpenGL back-end with Colored
, Textured
and TexturedColor
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.
Sourcepub fn get_current_program(&self) -> Option<GLuint>
pub fn get_current_program(&self) -> Option<GLuint>
Returns the current program
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_begin(&mut self, viewport: Viewport) -> Context
pub fn draw_begin(&mut self, viewport: Viewport) -> Context
Setup that should be called at the start of a frame’s draw call.
Sourcepub fn draw<F, U>(&mut self, viewport: Viewport, f: F) -> U
pub fn draw<F, U>(&mut self, viewport: Viewport, f: F) -> 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.
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)
Source§fn tri_list<F>(&mut self, draw_state: &DrawState, color: &[f32; 4], f: F)
fn tri_list<F>(&mut self, draw_state: &DrawState, color: &[f32; 4], f: F)
Source§fn tri_list_c<F>(&mut self, draw_state: &DrawState, f: F)
fn tri_list_c<F>(&mut self, draw_state: &DrawState, f: F)
tri_list
, but with individual vertex colors. Read moreSource§fn tri_list_uv<F>(
&mut self,
draw_state: &DrawState,
color: &[f32; 4],
texture: &Texture,
f: F,
)
fn tri_list_uv<F>( &mut self, draw_state: &DrawState, color: &[f32; 4], texture: &Texture, f: F, )
Source§fn tri_list_uv_c<F>(&mut self, draw_state: &DrawState, texture: &Texture, f: F)
fn tri_list_uv_c<F>(&mut self, draw_state: &DrawState, texture: &Texture, f: F)
tri_list_uv
, but with individual vertex colors. Read moreSource§fn rectangle<R>(
&mut self,
r: &Rectangle,
rectangle: R,
draw_state: &DrawState,
transform: [[f64; 3]; 2],
)
fn rectangle<R>( &mut self, r: &Rectangle, rectangle: R, draw_state: &DrawState, transform: [[f64; 3]; 2], )
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], )
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], )
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], )
Source§fn ellipse<R>(
&mut self,
e: &Ellipse,
rectangle: R,
draw_state: &DrawState,
transform: [[f64; 3]; 2],
)
fn ellipse<R>( &mut self, e: &Ellipse, rectangle: R, draw_state: &DrawState, transform: [[f64; 3]; 2], )
Auto Trait Implementations§
impl Freeze for GlGraphics
impl RefUnwindSafe for GlGraphics
impl Send for GlGraphics
impl Sync for GlGraphics
impl Unpin for GlGraphics
impl UnwindSafe for GlGraphics
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more