From 595c10c349e1810e1deb4ed192b7f6a54d554d70 Mon Sep 17 00:00:00 2001 From: Adrian Cochrane Date: Tue, 6 Jun 2023 13:28:12 +1200 Subject: [PATCH] Fix transformation matrix (should be fixed upstream, but that'd be breaking). --- lib/Graphics/Rendering/Rect/Backgrounds.hs | 2 +- lib/Graphics/Rendering/Rect/Types.hs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Graphics/Rendering/Rect/Backgrounds.hs b/lib/Graphics/Rendering/Rect/Backgrounds.hs index 6539cd6..9a3f374 100644 --- a/lib/Graphics/Rendering/Rect/Backgrounds.hs +++ b/lib/Graphics/Rendering/Rect/Backgrounds.hs @@ -17,4 +17,4 @@ renderBackgrounds :: (MonadIO m, MonadIO n) => n (Backgrounds -> Rects -> M44 Float -> m ()) renderBackgrounds = do base <- renderRectWith baseFragmentShader ["colour"] - return $ \self -> base [c $ background self] borderBox + return $ \self -> base [c $ background self] paddingBox diff --git a/lib/Graphics/Rendering/Rect/Types.hs b/lib/Graphics/Rendering/Rect/Types.hs index 33c1b06..8c7f304 100644 --- a/lib/Graphics/Rendering/Rect/Types.hs +++ b/lib/Graphics/Rendering/Rect/Types.hs @@ -71,7 +71,7 @@ renderRectWith fragmentShader uniformNames = do bufferGeometry 0 pbuf $ rect2geom $ getter rects glUseProgram prog - liftIO $ updateUniform prog matID mat + liftIO $ updateUniform prog matID $ mflip mat forM (zip uniformIDs uniforms) $ \(slot, cb) -> cb prog slot glBindVertexArray vao @@ -87,3 +87,6 @@ liftGL n = do case ret of Left err -> liftIO $ die err Right x -> return x + +mflip (V4 (V4 a b c d) (V4 e f g h) (V4 i j k l) (V4 m n o p)) = + V4 (V4 a e i m) (V4 b f j n) (V4 c g k o) (V4 d h l p) -- 2.30.2