From 7142ce9b55eb9246ead7d9215124576937b4b377 Mon Sep 17 00:00:00 2001 From: nek0 Date: Mon, 7 Dec 2020 16:02:57 +0100 Subject: [PATCH] bind buffers before reading from them --- src/Types/Graphics/IndexBuffer.hs | 1 + src/Types/Graphics/VertexBuffer.hs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Types/Graphics/IndexBuffer.hs b/src/Types/Graphics/IndexBuffer.hs index ca8c8b5..7dc7d1d 100644 --- a/src/Types/Graphics/IndexBuffer.hs +++ b/src/Types/Graphics/IndexBuffer.hs @@ -68,6 +68,7 @@ instance Buffer IndexBuffer where (fromIntegral currentBufSize `div` sizeOf (undefined :: StoreType IndexBuffer)) $ \ (ptr :: Ptr (StoreType IndexBuffer)) -> do + bind buf GL.bufferSubData (target buf) GL.ReadFromBuffer diff --git a/src/Types/Graphics/VertexBuffer.hs b/src/Types/Graphics/VertexBuffer.hs index e238db6..34fc34d 100644 --- a/src/Types/Graphics/VertexBuffer.hs +++ b/src/Types/Graphics/VertexBuffer.hs @@ -98,6 +98,7 @@ instance Buffer VertexBuffer where (fromIntegral currentBufSize `div` sizeOf (undefined :: StoreType VertexBuffer)) $ \ (ptr :: Ptr (StoreType VertexBuffer)) -> do + bind buf GL.bufferSubData (target buf) GL.ReadFromBuffer