Glow has a uniform_matrix_4_f32_slice method for uploading a mat4 uniform. It expects a&[f32] whilst Matrix4<f32> only has an Into implementation for [[f32; 4]; 4].
I've tried to construct using slice_from_raw_parts but end up with something that is 64 elements long (I'd have expected 16, although when multiplied by the size of an f32 it would be 64):
slice_from_raw_parts(
(matrix as *const Matrix4<f32>) as *const f32,
std::mem::size_of::<Matrix4<f32>>(),
);
This is clearly more of a "how do you do in Rust" question, but, how do I get a reference to the Matrix4<f32> as a &[f32]?
Glow has a
uniform_matrix_4_f32_slice
method for uploading a mat4 uniform. It expects a&[f32]
whilstMatrix4<f32>
only has anInto
implementation for[[f32; 4]; 4]
.I've tried to construct using
slice_from_raw_parts
but end up with something that is 64 elements long (I'd have expected 16, although when multiplied by the size of anf32
it would be 64):This is clearly more of a "how do you do in Rust" question, but, how do I get a reference to the
Matrix4<f32>
as a&[f32]
?