I'm trying to integrate the cgmath
library into my first experiments with glium
, but I can't figure out how to pass my Matrix4
object to the draw()
call.
My uniforms
object is defined thus:
let uniforms = uniform! {
matrix: cgmath::Matrix4::from_scale(0.1)
};
and this is my draw
call:
target.draw(&vertex_buffer, &index_slice, &program, &uniforms, &Default::default())
.unwrap();
which fails to compile with the message
error[E0277]: the trait bound `cgmath::Matrix4<{float}>: glium::uniforms::AsUniformValue` is not satisfied
I'm a total beginner with Rust, but I do believe I cannot implement this trait myself, as both it and the Matrix4
type are in a crate separate from mine.
Is there really no better option than to manually convert the matrix into an array of arrays of floats?