pituicat/src/Classes/Graphics/Buffer.hs

27 lines
631 B
Haskell
Raw Normal View History

2020-10-17 14:18:42 +00:00
{-# 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 ()