pituicat/src/Types/Graphics/VertexArray.hs

37 lines
732 B
Haskell
Raw Normal View History

2020-10-17 14:18:42 +00:00
{-# LANGUAGE TypeFamilies #-}
module Types.Graphics.VertexArray where
import qualified Graphics.Rendering.OpenGL as GL
import SDL (($=), get)
2020-12-05 09:10:37 +00:00
import qualified Data.Vector as V
2020-10-17 14:18:42 +00:00
2020-12-05 09:10:37 +00:00
import Foreign (sizeOf)
import Foreign.Ptr
import Control.Concurrent.STM
import Control.Monad (void)
2020-10-17 14:18:42 +00:00
-- internal imports
import Classes.Graphics.Bindable
import Classes.Graphics.Buffer
import Types.Graphics.VertexBuffer
2020-12-05 09:10:37 +00:00
newtype VertexArray = VertexArray
2020-10-17 14:18:42 +00:00
{ vArrId :: GL.VertexArrayObject
}
deriving (Eq, Show)
instance Bindable VertexArray where
bind va = GL.bindVertexArrayObject $= Just (vArrId va)
unbind va = GL.bindVertexArrayObject $= Nothing
newVertexArray :: IO VertexArray
newVertexArray = VertexArray
<$> GL.genObjectName