GLUtil-0.6.1: Miscellaneous OpenGL utilities.

Safe HaskellNone

Graphics.GLUtil.BufferObjects

Description

Utilities for filling BufferObjects.

Synopsis

Documentation

makeBuffer :: Storable a => BufferTarget -> [a] -> IO BufferObjectSource

Allocate and fill a BufferObject from a list of Storables.

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

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 BufferObjectSource

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 BufferObjectSource

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 BufferObjectSource

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 aSource

Produce a Ptr value to be used as an offset of the given number of bytes.

offset0 :: Ptr aSource

A zero-offset Ptr.