【问题标题】:Can't get Freeglut to work with Haskell on Windows无法让 Freeglut 在 Windows 上与 Haskell 一起工作
【发布时间】:2012-01-21 20:25:52
【问题描述】:

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

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

【问题讨论】:

  • 如果您的问题已经解决,请考虑关闭问题。

标签: opengl haskell freeglut


【解决方案1】:
  1. http://www.transmissionzero.co.uk/software/freeglut-devel/下载过剩

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

  3. 重命名为glut32.dll

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

【讨论】:

  • 谢谢。不错的技巧。
【解决方案2】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-29
    • 2011-04-25
    • 2014-11-22
    • 2014-05-15
    • 2010-10-16
    • 2019-11-27
    相关资源
    最近更新 更多