7

这是我试图开始工作的源代码:

在 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)
4

2 回答 2

6
  1. 从http://www.transmissionzero.co.uk/software/freeglut-devel/下载 glut

  2. 将文件复制freeglut-MinGW-3.0.0-1.mp.zip\freeglut\bin\x64\freeglut.dllC:\Windows\System32

  3. 将其重命名为glut32.dll

我刚刚解决了这个问题,希望这可以帮助其他人。

于 2015-09-27T14:17:28.700 回答
0

您必须使用 Mingw 的 freeglut .lib/.dll 或自己编译。

于 2012-01-27T13:34:42.430 回答