无法让Freeglut在Windows上与Haskell一起使用 [英] Can't get Freeglut to work with Haskell on Windows
问题描述
在Main.hs中:
pre> import Graphics.Rendering.OpenGL
import Graphics.UI.GLUT
导入绑定
导入Data.IORef
main = do
(progname,_)< - getArgsAndInitialize
createWindowHello World
reshapeCallback $ =正在重塑
keyboardMouseCallback $ =只是keyboardMouse
角度< - newIORef 0.0
displayCallback $ = display
idleCallback $ =只是闲置
mouseWheelCallback $ =只是mouseWheel
mainLoop
在Bindings.hs中:
模块绑定其中
import Graphics.Rendering.OpenGL
import Graphics.UI.GLUT
display :: IO()
display = return()
$ b $ overlayDisplay :: IO()
overlayDisplay = return()
visibility :: Visibility - > IO()
可见性v =返回()
reshape :: Size - > IO()
reshape s @(Size wh)= do
viewport $ =(Position 0 0,s)
close :: IO()
close = return()
keyboardMouse :: Key - > KeyState - >修饰符 - >位置 - > IO()
keyboardMouse键状态修饰符position = return()
mouseWheel :: WheelNumber - > WheelDirection - >位置 - > IO()
mouseWheel wn wd p = return()
idle :: IO()
idle = return()
如果我在我的代码中使用普通的glut32.dll并且没有freeglut扩展,但是我想使用freeglut扩展,它就可以工作。
当我使用freeglut.dll时,将其重命名为glut32.dll,并将它放在与我的.exe相同的文件夹中,它给了我错误信息:
main:用户错误(未知的GLUT入口glutInit)
当我以相同的方式使用正常的glut32.dll时,我收到错误消息:
main:user error(unknown GLUT entry glutMouseWheelFunc)
你必须使用Mingw的freeglut .lib / .dll或自己编译它。
Here is my source code I'm trying to get to work:
In 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
In 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 ()
It works if I use normal glut32.dll and none of the freeglut extensions in my code, but I want to use the freeglut extensions.
When I use freeglut.dll, rename it to glut32.dll, and put it in the same folder as my .exe, it gives me the error:
main: user error (unknown GLUT entry glutInit)
When I use the normal glut32.dll in the same way I get the error:
main: user error (unknown GLUT entry glutMouseWheelFunc)
You have to use freeglut .lib/.dll from Mingw or compile it yourself.
这篇关于无法让Freeglut在Windows上与Haskell一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!