27 lines
611 B
Haskell
27 lines
611 B
Haskell
{-# LANGUAGE TypeFamilies #-}
|
|
module BufferClass where
|
|
|
|
import qualified Graphics.Rendering.OpenGL as GL
|
|
|
|
import SDL (($=), get)
|
|
|
|
-- internal imports
|
|
|
|
import BindableClass
|
|
|
|
-- this aims to be a typeclass for all used buffer objects throughout the
|
|
-- tutorial.
|
|
-- 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 ()
|