Copyright | (C) 2015 Dimitri Sabadie |
---|---|
License | BSD3 |
Maintainer | Dimitri Sabadie <dimitri.sabadie@gmail.com> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
- data Buffer
- bufferID :: Buffer -> GLuint
- createBuffer :: forall a m rw. (BufferRW rw, MonadIO m, MonadResource m) => BuildRegion rw a -> m a
- createBuffer_ :: forall a m rw. (BufferRW rw, MonadIO m, MonadResource m) => BuildRegion rw a -> m (a, Buffer)
- class BufferRW rw
- data Region rw a
- data BuildRegion rw a
- newRegion :: forall rw a. Storable a => Word32 -> BuildRegion rw (Region rw a)
- readWhole :: (MonadIO m, Readable r, Storable a) => Region r a -> m [a]
- writeWhole :: (Foldable f, MonadIO m, Storable a, Writable w) => Region w a -> f a -> m ()
- fill :: (MonadIO m, Storable a, Writable w) => Region w a -> a -> m ()
- (@?) :: (MonadIO m, Storable a, Readable r) => Region r a -> Word32 -> m (Maybe a)
- (@!) :: (MonadIO m, Storable a, Readable r) => Region r a -> Word32 -> m a
- writeAt :: (MonadIO m, Storable a, Writable w) => Region w a -> Word32 -> a -> m ()
- writeAt' :: (MonadIO m, Storable a, Writable w) => Region w a -> Word32 -> a -> m ()
Buffer creation
data Buffer
A Buffer
is an opaque and untyped region of abstract GPU memory. You cannot do much with it
and you might even not see the type in the user interface as it’s not really needed. It’s shown
for informational purposes only.
createBuffer :: forall a m rw. (BufferRW rw, MonadIO m, MonadResource m) => BuildRegion rw a -> m a
Create a new Buffer
and expose Region
s. Through the BuildRegion
type, you can yield new
regions and embed them in the type of your choice. The function returns that type.
createBuffer_ :: forall a m rw. (BufferRW rw, MonadIO m, MonadResource m) => BuildRegion rw a -> m (a, Buffer)
Buffer access
class BufferRW rw
bufferFlagsFromRW
Buffer regions
data BuildRegion rw a
Convenient type to build Region
s.
Monad (BuildRegion rw) | |
Functor (BuildRegion rw) | |
Applicative (BuildRegion rw) |
newRegion :: forall rw a. Storable a => Word32 -> BuildRegion rw (Region rw a)
Create a new Region
by providing the number of wished elements.
Operations on buffer regions
(@?) :: (MonadIO m, Storable a, Readable r) => Region r a -> Word32 -> m (Maybe a)
Index getter. Bounds checking is performed and returns Nothing
if out of bounds.
(@!) :: (MonadIO m, Storable a, Readable r) => Region r a -> Word32 -> m a
Index getter. Unsafe version of '(@?)'.