pituicat/src/Classes/Graphics/Buffer.hs
2020-10-17 16:19:18 +02:00

27 lines
631 B
Haskell

{-# LANGUAGE TypeFamilies #-}
module Classes.Graphics.Buffer where
import qualified Graphics.Rendering.OpenGL as GL
import SDL (($=), get)
-- internal imports
import Classes.Graphics.Bindable
-- this aims to be a typeclass for all used buffer objects throughout the
-- game.
-- think of it as some kind of interface in the object oriented context
class (Bindable a) => Buffer a where
type ObjName a :: *
-- what buffer target does te buffer bind to
target :: a -> GL.BufferTarget
-- what ID does the buffer have
glId :: a -> ObjName a
-- bind the buffer object and fill it with data
initialize :: a -> IO ()