Safe Haskell | None |
---|---|
Language | Haskell2010 |
Utilities for filling BufferObject
s.
Synopsis
- makeBuffer :: Storable a => BufferTarget -> [a] -> IO BufferObject
- makeBufferLen :: forall a. Storable a => BufferTarget -> Int -> [a] -> IO BufferObject
- replaceBuffer :: forall a. Storable a => BufferTarget -> [a] -> IO ()
- fromPtr :: BufferTarget -> Int -> Ptr a -> IO BufferObject
- fromByteString :: BufferTarget -> ByteString -> IO BufferObject
- fromForeignPtr :: forall a. Storable a => BufferTarget -> Int -> ForeignPtr a -> IO BufferObject
- fromVector :: forall a. Storable a => BufferTarget -> Vector a -> IO BufferObject
- replaceVector :: forall a. Storable a => BufferTarget -> Vector a -> IO ()
- offsetPtr :: Int -> Ptr a
- offset0 :: Ptr a
- class BufferSource v where
- fromSource :: BufferTarget -> v -> IO BufferObject
- bufferIndices :: BufferSource (v Word32) => v Word32 -> IO BufferObject
Documentation
makeBuffer :: Storable a => BufferTarget -> [a] -> IO BufferObject Source #
Allocate and fill a BufferObject
from a list of Storable
s.
makeBufferLen :: forall a. Storable a => BufferTarget -> Int -> [a] -> IO BufferObject Source #
Allocate and fill a BufferObject
from a list of Storable
s
whose length is explicitly given. This is useful when the list is
of known length, as it avoids a traversal to find the length.
replaceBuffer :: forall a. Storable a => BufferTarget -> [a] -> IO () Source #
replaceBuffer target elements
replaces the buffer data attached
to the buffer object currently bound to target
with the supplied
list. Any previous data is deleted.
fromPtr :: BufferTarget -> Int -> Ptr a -> IO BufferObject Source #
Allocate and fill a BufferObject
with the given number of bytes
from the supplied pointer.
fromByteString :: BufferTarget -> ByteString -> IO BufferObject Source #
Fill a buffer with a ByteString
.
fromForeignPtr :: forall a. Storable a => BufferTarget -> Int -> ForeignPtr a -> IO BufferObject Source #
Fill a buffer with data from a ForeignPtr
. The application
fromForeignPtr target len fptr
fills a target
BufferTarget
with len
elements starting from fptr
.
fromVector :: forall a. Storable a => BufferTarget -> Vector a -> IO BufferObject Source #
Fill a buffer with data from a Vector
.
replaceVector :: forall a. Storable a => BufferTarget -> Vector a -> IO () Source #
replaceVector target v
replaces the buffer data attached to the
buffer object currently bound to target
with the supplied
Vector
. Any previous data is deleted.
offsetPtr :: Int -> Ptr a Source #
Produce a Ptr
value to be used as an offset of the given number
of bytes.
class BufferSource v where Source #
A class for things we know how to serialize into an OpenGL buffer.
fromSource :: BufferTarget -> v -> IO BufferObject Source #
Instances
Storable a => BufferSource [a] Source # | |
Defined in Graphics.GLUtil.BufferObjects fromSource :: BufferTarget -> [a] -> IO BufferObject Source # | |
Storable a => BufferSource (Vector a) Source # | |
Defined in Graphics.GLUtil.BufferObjects fromSource :: BufferTarget -> Vector a -> IO BufferObject Source # |
bufferIndices :: BufferSource (v Word32) => v Word32 -> IO BufferObject Source #
Create an ElementArrayBuffer
from a source of Word32
s.