Skip to content

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

@deepfire

Description

@deepfire

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..

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions