renderer-tutorial/src/BufferClass.hs

27 lines
611 B
Haskell
Raw Normal View History

2020-05-20 03:54:14 +00:00
{-# LANGUAGE TypeFamilies #-}
2020-05-18 02:58:45 +00:00
module BufferClass where
import qualified Graphics.Rendering.OpenGL as GL
import SDL (($=), get)
2020-05-21 16:17:38 +00:00
-- internal imports
import BindableClass
2020-05-18 02:58:45 +00:00
-- 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
2020-05-21 16:17:38 +00:00
class (Bindable a) => Buffer a where
2020-05-18 02:58:45 +00:00
2020-05-20 03:54:14 +00:00
type ObjName a :: *
2020-05-18 02:58:45 +00:00
-- what buffer target does te buffer bind to
target :: a -> GL.BufferTarget
-- what ID does the buffer have
2020-05-20 03:54:14 +00:00
glId :: a -> ObjName a
2020-05-18 02:58:45 +00:00
-- bind the buffer object and fill it with data
initialize :: a -> IO ()