windows - 无法让 Freeglut 在 Windows 上与 Haskell 一起工作

标签 windows haskell opengl freeglut

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

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

最佳答案

  1. http://www.transmissionzero.co.uk/software/freeglut-devel/ 下载过剩.请务必下载 MinGW 版本。

  2. 将文件 freeglut-MinGW-3.0.0-1.mp.zip\freeglut\bin\x64\freeglut.dll 复制到 C:\Windows\System32。确保从 x64 文件夹中获取 64 位版本。

  3. 重命名为glut32.dll

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

关于windows - 无法让 Freeglut 在 Windows 上与 Haskell 一起工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20038674/

相关文章:

c++ - Windows C++ : Prioritizing threads to prevent main thread being preempted

windows - 针对位于系统其他位置的存储库运行 "git status"

java - 文件选择器中的 NPE

haskell - 我可以制作一个消耗所有生产者输出并将其作为列表传递的管道吗?

c++ - 用我的应用程序打包一个 jre

haskell - 使用 Julius 或 Lucius 将脚本或样式添加到页面的 <head>

haskell - 关于 Haskell 中的组合的困惑

c++ - Ubuntu 12.04 上的教程 OpenGL 4

c - 我已经输入 glutPostRedisplay();但它不会刷新窗口和/或输出?

opengl - 渲染具有多个索引的网格