diff options
Diffstat (limited to 'opengl-bindings/src/shader.rs')
| -rw-r--r-- | opengl-bindings/src/shader.rs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/opengl-bindings/src/shader.rs b/opengl-bindings/src/shader.rs index 5ed66a2..d3ce530 100644 --- a/opengl-bindings/src/shader.rs +++ b/opengl-bindings/src/shader.rs @@ -3,8 +3,8 @@ use std::ptr::null_mut; use safer_ffi::layout::ReprC; -use crate::data_types::{Matrix, Vec3}; use crate::CurrentContextWithFns; +use crate::data_types::{Matrix, Vec3}; #[derive(Debug)] pub struct Shader @@ -189,6 +189,16 @@ impl Program } } + pub fn set_uniform_at_location( + &self, + current_context: &CurrentContextWithFns<'_>, + location: UniformLocation, + var: &impl UniformVariable, + ) + { + var.set(current_context, self, location); + } + pub fn set_uniform( &self, current_context: &CurrentContextWithFns<'_>, @@ -334,6 +344,14 @@ impl sealed::Sealed for Matrix<f32, 4, 4> {} #[derive(Debug)] pub struct UniformLocation(crate::sys::types::GLint); +impl UniformLocation +{ + pub fn from_number(number: i32) -> Self + { + Self(number) + } +} + /// Shader error. #[derive(Debug, thiserror::Error)] pub enum Error |
