问题
Where is the OpenGL function for loadMatrixf and what is the type signature?
回答1:
See the Matrix class. I think you are looking for either newMatrix
or the matrix
StateVar in those docs.
For example: let mat
be a list of 16 floats representing the matrix. Then you would use it something like this:
import qualified Graphics.Rendering.OpenGL.GL as GL
drawThingWithMatrix :: [GL.GLfloat] -> IO ()
drawThingWithMatrix mat = GL.preservingMatrix $ do -- instead of push/pop
newmat <- GL.newMatrix GL.RowMajor mat -- or ColumnMajor
GL.currentMatrix GL.$= newmat
-- draw your thing
That's about right I think. It has been a while.
来源:https://stackoverflow.com/questions/6108335/haskell-loadmatrixf