Closed ekmett closed 8 years ago
I ran into this issue as well in #33. I wouldn't consider the solution (was there one?) awesome. Now I'm just using GLUtil which adds support. Seems like haskell-opengl should provide this though. :+1:
Just for reference for people who don't want to use GLUtil
- the way it did that was rather simple:
unUL :: GL.UniformLocation -> GLint
unUL = unsafeCoerce
uniformGLMat4 :: GL.UniformLocation -> GL.SettableStateVar (GL.GLmatrix GL.GLfloat)
uniformGLMat4 loc = GL.makeSettableStateVar aux
where aux m = GL.withMatrix m $ \_ -> GLRaw.glUniformMatrix4fv loc' 1 1
loc' = unUL loc
Apart from the ugly unsafeCoerce
to pass the uniform location to the native code, it's no rocket science. What are the plans to solve that? Are you perhaps waiting for a PR?
This has been fixed in b1b50031f7880b918fc6ec056342c5c89f118213, I'm about to make a new release on Hackage.
There doesn't appear to be a way to set up mat4 matrices for e.g. perspective matrices in shaders.