GLUtil-0.2.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 :: 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.

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.

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.