我刚刚成功安装了 Ubuntu,主要是为了让使用 Haskell 库比在 Windows 中更容易。
当我运行一些我正在处理的 Haskell 代码时,它只会让我大吃一惊。我正在为我的游戏使用 FunGen 库,当我尝试运行它时出现此错误。
freeglut (FunGen app): ERROR: Internal error <FBConfig with necessary capabilities nt found> in function fgOpenWindow
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 4 (X_DestroyWindow)
Resource id in failed request: 0x0
Serial number of failed request: 33
Current serial number in output stream: 36
经过一些网络搜索后,我找到了一种在 C 代码中解决此问题的方法(使用GlutDouble
代替GlDouble
),并且我Graphics.Rendering.OpenGL.GLdouble
在我的 Haskell 代码中使用了该类型。
更多研究告诉我,类型 GlDouble = Double,所以,这不是原因,此外,我刚刚删除了代码中的 gldouble 部分,但它仍然不起作用。所以,这里有一些简单的代码让我看到上一个错误:
module Main where
import Graphics.UI.Fungen
width, height :: Int
width = 600
height = 400
w = fromIntegral width
h = fromIntegral height
main :: IO ()
main = do
let winConfig = ((200, 200), (width, height), "game");
gameMap = (textureMap 0 w h w h);
funInit winConfig gameMap [] () () [] gameCycle (Timer 30) []
gameCycle :: IOGame () () () () ()
gameCycle = do
showFPS TimesRoman24 (w-40,0) 1.0 0.0 0.0
关于版本,我得到了:freeglut3 2.6.0-1ubuntu2、ghc 6.12.3、fungen 0.3、haskell glut 2.2.2.0 和 ubuntu 11.04
这有发生在其他人身上吗?