diff --git a/src/main.rs b/src/main.rs index 7df1d18..3e99a2a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -236,6 +236,8 @@ fn main() { .attach_file("./shaders/simple.frag") .link() }; + // get uniform location for the matrix (named `transform` in your vertex shader) + let transform_loc = unsafe { simple_shader.get_uniform_location("transform") }; // Used to demonstrate keyboard handling for exercise 2. let mut _arbitrary_number = 0.0; // feel free to remove @@ -298,6 +300,11 @@ fn main() { // == // Issue the necessary gl:: commands to draw your scene here simple_shader.activate(); + // build and send the transform matrix (start from identity) + let mut transform = glm::identity(); + // modify element (0,0) here; change indices to test a, b, c, d, e, f, etc. + transform[(0,0)] = elapsed.sin(); + gl::UniformMatrix4fv(transform_loc, 1, gl::FALSE, transform.as_ptr()); gl::BindVertexArray(my_vao); gl::DrawElements( gl::TRIANGLES,