2020-10-17 14:18:42 +00:00
|
|
|
{-# LANGUAGE TypeFamilies #-}
|
2021-04-29 18:28:52 +00:00
|
|
|
module Graphics.Types.VertexArray where
|
2020-10-17 14:18:42 +00:00
|
|
|
|
|
|
|
import qualified Graphics.Rendering.OpenGL as GL
|
|
|
|
|
2021-01-11 09:33:20 +00:00
|
|
|
import SDL (($=))
|
2020-10-17 14:18:42 +00:00
|
|
|
|
|
|
|
-- internal imports
|
|
|
|
|
2021-04-29 18:28:52 +00:00
|
|
|
import Graphics.Classes.Bindable
|
2020-10-17 14:18:42 +00:00
|
|
|
|
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)
|
|
|
|
|
2021-01-11 09:33:20 +00:00
|
|
|
unbind _ = GL.bindVertexArrayObject $= Nothing
|
2020-10-17 14:18:42 +00:00
|
|
|
|
|
|
|
newVertexArray :: IO VertexArray
|
|
|
|
newVertexArray = VertexArray
|
|
|
|
<$> GL.genObjectName
|