module Graphics.GL.Low.VAO
(
VAO,
newVAO,
deleteVAO,
bindVAO
) where
import Foreign.Storable
import Foreign.Marshal
import Graphics.GL
import Graphics.GL.Low.Classes
newtype VAO = VAO GLuint deriving Show
instance GLObject VAO where
glObjectName (VAO n) = fromIntegral n
newVAO :: IO VAO
newVAO = do
n <- alloca (\ptr -> glGenVertexArrays 1 ptr >> peek ptr)
return (VAO n)
deleteVAO :: VAO -> IO ()
deleteVAO (VAO n) = withArray [n] (\ptr -> glDeleteVertexArrays 1 ptr)
bindVAO :: VAO -> IO ()
bindVAO (VAO n) = glBindVertexArray n