deepfire / reflex-glfw

A GLFW-b adapter for the Haskell Reflex FRP implementation.
BSD 3-Clause "New" or "Revised" License
10 stars 2 forks source link

GLFW error callback doesn't appear to work, at least during GLFW init time #6

Open deepfire opened 7 years ago

deepfire commented 7 years ago

As an example, the reflex-glfw-demo is incompatible with OpenGL 3.3, so changing withGLWindow like this:

withGLWindow width height title f = do
     liftIO $ GL.setErrorCallback $ Just simpleErrorPrinter
+    liftIO $ GL.defaultWindowHints
+    liftIO $ mapM_ GL.windowHint
+      [ GL.WindowHint'ContextVersionMajor 3
+      , GL.WindowHint'ContextVersionMinor 3
+      , GL.WindowHint'OpenGLProfile GL.OpenGLProfile'Core
+      , GL.WindowHint'OpenGLForwardCompat True ]
     m <- liftIO $ GL.createWindow width height title Nothing Nothing

makes the demo fail obscurely, without invoking the error callback:

[nix-shell:~/src/reflex-glfw]$ cabal build && dist/build/reflex-glfw-demo/reflex-glfw-demo
Building reflex-glfw-0.1.0.0...
Preprocessing library reflex-glfw-0.1.0.0...
[1 of 1] Compiling Reflex.GLFW      ( src/Reflex/GLFW.hs, dist/build/Reflex/GLFW.o )
Preprocessing executable 'reflex-glfw-demo' for reflex-glfw-0.1.0.0...
Linking dist/build/reflex-glfw-demo/reflex-glfw-demo ...
reflex-glfw-demo: Prelude.head: empty list

A similar failure to invoke the handler can be observed if one fails to run Reflex.GLFW.init -- the error message is produced by withGLWindow itself, not the simpleErrorPrinter handler that is set up by the time of its invocation.

It is a bit mysterious..