Advertisement
Arcaedox

HGL SEG fault

Apr 14th, 2015
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import qualified Graphics.UI.GLFW as GLFW
  2. import Graphics.Rendering.OpenGL
  3. import qualified Control.Concurrent as C
  4. import FRP.Elerea.Param
  5. import Control.Monad
  6.  
  7. main :: IO ()
  8. main = do
  9.     ic <- GLFW.init
  10.     when ic $ do
  11.         m <- GLFW.createWindow 640 480 "ARC-1" Nothing Nothing
  12.         case m of
  13.           (Just win) -> do
  14.               GLFW.makeContextCurrent m
  15.               GLFW.setErrorCallback $ Just (\e s -> putStrLn $ unwords [show e, show s])
  16.               GLFW.setWindowCloseCallback win $ Just (GLFW.destroyWindow)      
  17.               clearColor $= Color4 0.0 1.0 1.0 1
  18.               loop win
  19.           Nothing -> return ()
  20.         GLFW.terminate
  21.  
  22. loop :: GLFW.Window -> IO ()
  23. loop w = do
  24.     --print =<< GLFW.getCursorPos w
  25.     clear [ColorBuffer, DepthBuffer]
  26.     GLFW.swapBuffers w
  27.     C.threadDelay 1000000
  28.     loop w
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement