GLUtil-0.8: Miscellaneous OpenGL utilities.

Safe HaskellNone
LanguageHaskell98

Graphics.GLUtil.BufferObjects

Description

Utilities for filling BufferObjects.

Synopsis

Documentation

makeBuffer :: Storable a => BufferTarget -> [a] -> IO BufferObject Source

Allocate and fill a BufferObject from a list of Storables.

makeBufferLen :: forall a. Storable a => BufferTarget -> Int -> [a] -> IO BufferObject Source

Allocate and fill a BufferObject from a list of Storables 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.

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.

offset0 :: Ptr a Source

A zero-offset Ptr.

class BufferSource v where Source

A class for things we know how to serialize into an OpenGL buffer.

Instances

Storable a => BufferSource [a] 
Storable a => BufferSource (Vector a)