diff options
Diffstat (limited to 'engine/src/opengl')
-rw-r--r-- | engine/src/opengl/shader.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/engine/src/opengl/shader.rs b/engine/src/opengl/shader.rs index 0bbca77..603c790 100644 --- a/engine/src/opengl/shader.rs +++ b/engine/src/opengl/shader.rs @@ -1,6 +1,8 @@ use std::ffi::CStr; use std::ptr::null_mut; +use crate::matrix::Matrix; + #[derive(Debug)] pub struct Shader { @@ -156,6 +158,16 @@ impl Program } } + pub fn set_uniform_matrix_4fv(&self, name: &CStr, matrix: &Matrix<f32, 4, 4>) + { + let uniform_location = + unsafe { gl::GetUniformLocation(self.program, name.as_ptr().cast()) }; + + unsafe { + gl::UniformMatrix4fv(uniform_location, 1, gl::FALSE, matrix.as_ptr()); + } + } + fn get_info_log(&self) -> String { let mut buf = vec![gl::types::GLchar::default(); 512]; |