I can't find any function for performing a glUniformMatrix*.
If I remember correctly I looked into it (partially) as the same problem was brought forward by #14 . The problem with extending the current implementation for vectors is that there is no specific datatype for matrices. So far I've thought of two possible solutions.
Mat4x4 a = Vec4 (Vec4 a)
How about supporting Data.Vect.Float? I'm not quite familiar with both libraries, but they appear to complement each other well. There is a Data.Vect.Float Module for using the libraries vectors and matrices in OpenGL context, but it's only tailored towards the old pipeline and not glUniformMatrix*.
In OpenGL-2.9 binding, where UniformLocation type constructor is exported
(UniformLocation mvp) <- get (uniformLocation prog "mvp")
can be used with OpenGLRaw. If you store matrix in Data.Vector.Storable then
-- mvpVec :: Vector GLfloat
unsafeWith mvpVec (\ptr -> glUniformMatrix4fv mvp 1 0 ptr)
can be used to upload matrix to the shader uniform.
I'm not sure of the difference, but you can also use
withArray mvpVec (\ptr -> glUniformMatrix4fv mvp 1 0 ptr)
Maybe it's 'less unsafe' ?
It is probably unsafe function because pointer should be used only to read - not to write - into that memory. It should be okay when you are just sending data to OpenGL. But I am not so sure about differences between Array/Vector/Repa... in FP/Haskell either. I use Vector in my math package.
I have some Uniform instances in my linear-opengl package that may be of interest here.