-- Take the minimum of the maximum viewport and texture size to figure out
-- how large of a frame buffer we can allocate and render into
maxRenderSize :: IO (Int, Int)
maxRenderSize =
    withArray [0, 0] $ \ptr -> do
        GLR.glGetIntegerv GLR.GL_MAX_VIEWPORT_DIMS ptr
        [vpWdh, vpHgt] <- peekArray 2 ptr
        GLR.glGetIntegerv GLR.GL_MAX_TEXTURE_SIZE ptr
        texDim <- peek ptr
        return (fromIntegral $ min vpWdh texDim, fromIntegral $ max vpHgt texDim)
maxRenderSize :: IO (Int, Int)
maxRenderSize =
    withArray [0, 0] $ \ptr -> do
        GLR.glGetIntegerv GLR.GL_MAX_VIEWPORT_DIMS ptr
        [vpWdh, vpHgt] <- peekArray 2 ptr
        GLR.glGetIntegerv GLR.GL_MAX_TEXTURE_SIZE ptr
        texDim <- peek ptr
        return (fromIntegral $ min vpWdh texDim, fromIntegral $ max vpHgt texDim)
maxRenderSize =
    withArray [0, 0] $ \ptr -> do
        GLR.glGetIntegerv GLR.GL_MAX_VIEWPORT_DIMS ptr
        [vpWdh, vpHgt] <- peekArray 2 ptr
        GLR.glGetIntegerv GLR.GL_MAX_TEXTURE_SIZE ptr
        texDim <- peek ptr
        return (fromIntegral $ min vpWdh texDim, fromIntegral $ max vpHgt texDim)