pituicat/src/Graphics/Types/VertexArray.hs

26 lines
521 B
Haskell

{-# LANGUAGE TypeFamilies #-}
module Graphics.Types.VertexArray where
import qualified Graphics.Rendering.OpenGL as GL
import SDL (($=))
-- internal imports
import Graphics.Classes.Bindable
newtype VertexArray = VertexArray
{ vArrId :: GL.VertexArrayObject
}
deriving (Eq, Show)
instance Bindable VertexArray where
bind va = GL.bindVertexArrayObject $= Just (vArrId va)
unbind _ = GL.bindVertexArrayObject $= Nothing
newVertexArray :: IO VertexArray
newVertexArray = VertexArray
<$> GL.genObjectName