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.
As an example, the
reflex-glfw-demo
is incompatible with OpenGL 3.3, so changingwithGLWindow
like this:makes the demo fail obscurely, without invoking the error callback:
A similar failure to invoke the handler can be observed if one fails to run
Reflex.GLFW.init
-- the error message is produced bywithGLWindow
itself, not thesimpleErrorPrinter
handler that is set up by the time of its invocation.It is a bit mysterious..