pub struct Program { /* private fields */ }
Expand description
Program is opengl shader program wrapper main feature is setting uniforms. There are some predefined functions for setting them but you can also define new ones because there is lot of variants. Already defined setters should guid you. Note that even though you can clone Program you are just cloning pointer to program.
Implementations§
Source§impl Program
impl Program
Sourcepub fn new(paths: &[&str]) -> Result<Program, String>
pub fn new(paths: &[&str]) -> Result<Program, String>
new creates shadre program from path of vertex and fragment shader files
Sourcepub fn from_shaders(shaders: &[Shader]) -> Result<Program, String>
pub fn from_shaders(shaders: &[Shader]) -> Result<Program, String>
from_shaders is same as new it just uses already loaded shaders
pub fn no_texture() -> Program
Sourcepub fn get_ptr(&self, name: &str) -> i32
pub fn get_ptr(&self, name: &str) -> i32
get_ptr returns pointer to uniform var of shader by name
pub fn set_mat4(&self, address: &str, mat: &Mat)
pub fn set_vec2(&self, address: &str, vec: Vect)
pub fn set_color(&self, address: &str, col: &RGBA)
pub fn set_float(&self, address: &str, value: f32)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Program
impl RefUnwindSafe for Program
impl Send for Program
impl Sync for Program
impl Unpin for Program
impl UnwindSafe for Program
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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