openWindowGLFW :: IORef GLFWState -> Window -> IO ()
openWindowGLFW ref win = do

  --GLFW.windowHint $ GLFW.WindowHint'ContextVersionMajor 3
  --GLFW.windowHint $ GLFW.WindowHint'ContextVersionMajor 2
  --GLFW.windowHint $ GLFW.WindowHint'OpenGLForwardCompat False
  --GLFW.windowHint $ GLFW.WindowHint'OpenGLProfile GLFW.OpenGLProfile'Core

  --GLFW.windowHint $ GLFW.WindowHint'Resizable False

  let (sizeX, sizeY) = win^.windowSize
  maybeMonitor <-
    case win^.windowState of
      WindowFullscreen -> GLFW.getPrimaryMonitor
      WindowFloating   -> return Nothing
  glfwWin <- GLFW.createWindow sizeX sizeY (win^.windowName)
                maybeMonitor Nothing

  ref & glfwWindow @~ glfwWin

  GLFW.makeContextCurrent glfwWin

  -- Try to enable sync-to-vertical-refresh by setting the number
  -- of buffer swaps per vertical refresh to 1.
  GLFW.swapInterval 1

-- Dump State -----------------------------------------------------------------
-- | Print out the internal GLFW state.
--   This code is taken from a sample in the GLFW repository.
--   TODO: Implement a standard state dump across all backends.
openWindowGLFW :: IORef GLFWState -> Window -> IO ()
openWindowGLFW ref win = do

  --GLFW.windowHint $ GLFW.WindowHint'ContextVersionMajor 3
  --GLFW.windowHint $ GLFW.WindowHint'ContextVersionMajor 2
  --GLFW.windowHint $ GLFW.WindowHint'OpenGLForwardCompat False
  --GLFW.windowHint $ GLFW.WindowHint'OpenGLProfile GLFW.OpenGLProfile'Core

  --GLFW.windowHint $ GLFW.WindowHint'Resizable False

  let (sizeX, sizeY) = win^.windowSize
  maybeMonitor <-
    case win^.windowState of
      WindowFullscreen -> GLFW.getPrimaryMonitor
      WindowFloating   -> return Nothing
  glfwWin <- GLFW.createWindow sizeX sizeY (win^.windowName)
                maybeMonitor Nothing

  ref & glfwWindow @~ glfwWin

  GLFW.makeContextCurrent glfwWin

  -- Try to enable sync-to-vertical-refresh by setting the number
  -- of buffer swaps per vertical refresh to 1.
  GLFW.swapInterval 1

-- Dump State -----------------------------------------------------------------
-- | Print out the internal GLFW state.
--   This code is taken from a sample in the GLFW repository.
--   TODO: Implement a standard state dump across all backends.
openWindowGLFW ref win = do

  --GLFW.windowHint $ GLFW.WindowHint'ContextVersionMajor 3
  --GLFW.windowHint $ GLFW.WindowHint'ContextVersionMajor 2
  --GLFW.windowHint $ GLFW.WindowHint'OpenGLForwardCompat False
  --GLFW.windowHint $ GLFW.WindowHint'OpenGLProfile GLFW.OpenGLProfile'Core

  --GLFW.windowHint $ GLFW.WindowHint'Resizable False

  let (sizeX, sizeY) = win^.windowSize
  maybeMonitor <-
    case win^.windowState of
      WindowFullscreen -> GLFW.getPrimaryMonitor
      WindowFloating   -> return Nothing
  glfwWin <- GLFW.createWindow sizeX sizeY (win^.windowName)
                maybeMonitor Nothing

  ref & glfwWindow @~ glfwWin

  GLFW.makeContextCurrent glfwWin

  -- Try to enable sync-to-vertical-refresh by setting the number
  -- of buffer swaps per vertical refresh to 1.
  GLFW.swapInterval 1

-- Dump State -----------------------------------------------------------------
-- | Print out the internal GLFW state.
--   This code is taken from a sample in the GLFW repository.
--   TODO: Implement a standard state dump across all backends.