[Haskell-cafe] Back on opengl win32 again? no window

bbrown bbrown at botspiritcompany.com
Mon Oct 22 14:04:34 EDT 2007


Ok, sorry to bring this back up again.  I asked before and kind of went to a 
working linux system. 

My question;  On Win32, has anyone seen where you try to run the application 
but the window will not stay open.  There are no errors, the window with 3D 
objects will not stay open.  I was using a recent haskell 6.6.1 (ghc-6.6.1-
i386-windows.exe).

I asked before it seemed like the others suggested I use freeglut and use 
that.  But I dont really need freeglut extensions.  I am using basic opengl.  
I noticed that opengl is included in the ghc (mingw) I downloaded.  Also, the 
code compiles, just doesnt run.  The machine itself is a 3.2ghz, nvidia 
machine (win2k).  I know opengl code should work.

You can see the source here:
http://octanemech.googlecode.com/svn/trunk/octanemech/src/misc/camera/

I compiled with:
ghc --make MechCamera.hs -prof -auto-all -o $@

Basically the initialization aspect:

import Graphics.Rendering.OpenGL
import Graphics.UI.GLUT
import Data.IORef

mechLaunchGLWindow = do
  getArgsAndInitialize
  -- Initialize with the following settings
  -- Double buffer, RGBA color
  -- Alpha components supported, Depth buffer
  initialDisplayMode $= [ DoubleBuffered, RGBAMode, WithDepthBuffer, 
                             WithAlphaComponent ]
  initialWindowSize $= Size mechScreenWidth mechScreenHeight
  createWindow mechWindowTitle
               
  mechInitGL
  let mainCamera = initCamera (1.4, 4.2, -4.5) (0,0,0) (0,0,0)
      mainMech = initMech (0, 0, 0) (0, 0, 0)
  mainCameraRef <- newIORef(mainCamera)
  mainMechRef <- newIORef(mainMech)
            
  -- Set the OpenGL callbacks
  displayCallback $= displayGameLoop mainCameraRef mainMechRef

  -- Set the keyboard callback for handling actions
  keyboardMouseCallback $= Just (mechKeyPressed mainCameraRef)

  idleCallback $= Just idle            
  mainLoop


--
Berlin Brown
[berlin dot brown at gmail dot com]
http://botspiritcompany.com/botlist/?



More information about the Haskell-Cafe mailing list