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

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.

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.

Minimal complete definition

fromSource

Methods

fromSource :: BufferTarget -> v -> IO BufferObject Source #

Instances

Storable a => BufferSource [a] Source # 

Methods

fromSource :: BufferTarget -> [a] -> IO BufferObject Source #

Storable a => BufferSource (Vector a) Source # 

Methods

fromSource :: BufferTarget -> Vector a -> IO BufferObject Source #

bufferIndices :: BufferSource (v Word32) => v Word32 -> IO BufferObject Source #

Create an ElementArrayBuffer from a source of Word32s.