Haskell loadMatrixf

大憨熊 提交于 2020-01-04 06:25:48

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!