这是我想要开始工作的源代码:
在Main.hs中:
import Graphics.Rendering.OpenGL
import Graphics.UI.GLUT
import Bindings
import Data.IORef
main = do
(progname,_) <- getArgsAndInitialize
createWindow "Hello World"
reshapeCallback $= Just reshape
keyboardMouseCallback $= Just keyboardMouse
angle <- newIORef 0.0
displayCallback $= display
idleCallback $= Just idle
mouseWheelCallback $= Just mouseWheel
mainLoop
在Bindings.hs中:
module Bindings where
import Graphics.Rendering.OpenGL
import Graphics.UI.GLUT
display :: IO ()
display = return ()
overlayDisplay :: IO ()
overlayDisplay = return ()
visibility :: Visibility -> IO ()
visibility v = return ()
reshape :: Size -> IO ()
reshape s@(Size w h) = do
viewport $= (Position 0 0, s)
close :: IO ()
close = return ()
keyboardMouse :: Key -> KeyState -> Modifiers -> Position -> IO ()
keyboardMouse key state modifiers position = return ()
mouseWheel :: WheelNumber -> WheelDirection -> Position -> IO ()
mouseWheel wn wd p = return ()
idle :: IO ()
idle = return ()
如果我在我的代码中使用普通的glut32.dll并且没有freeglut扩展,那么它有效,但我想使用freeglut扩展。
当我使用freeglut.dll时,将其重命名为glut32.dll,并将其放在与我的.exe相同的文件夹中,它会给我错误:
main: user error (unknown GLUT entry glutInit)
当我使用正常的glut32.dll时,我得到错误:
main: user error (unknown GLUT entry glutMouseWheelFunc)
答案 0 :(得分:0)
您必须使用Mingw的freeglut .lib / .dll或自行编译。
答案 1 :(得分:0)
将文件freeglut-MinGW-3.0.0-1.mp.zip\freeglut\bin\x64\freeglut.dll
复制到C:\Windows\System32
将其重命名为glut32.dll
我刚刚解决了这个问题,并希望这可以帮助其他人。