OpenGL-2.8.0.0: A binding for the OpenGL graphics system

Portability | portable
Stability | stable
Maintainer | sven.panne@aedion.de
Safe Haskell | None

Graphics.Rendering.OpenGL.GL.BufferObjects

Contents

- Object Names
- Buffer Objects
- Binding Buffer Objects
- Handling Buffer Data
- Mapping Buffer Objects
- Indexed Buffer manipulation

Description

This module corresponds to section 2.9 (Buffer Objects) of the OpenGL 2.1 specs.

Synopsis

- module Graphics.Rendering.OpenGL.GL.ObjectName
- newtype BufferObject = BufferObject GLuint
- data BufferTarget
  - = ArrayBuffer
  - | CopyReadBuffer
  - | CopyWriteBuffer
  - | ElementArrayBuffer
  - | PixelPackBuffer
  - | PixelUnpackBuffer
  - | TransformFeedbackBuffer
- bindBuffer :: BufferTarget -> StateVar (Maybe BufferObject)
- arrayBufferBinding :: ClientArrayType -> GettableStateVar (Maybe BufferObject)
- vertexAttribArrayBufferBinding :: AttribLocation -> GettableStateVar (Maybe BufferObject)
- data BufferUsage
  - = StreamDraw
  - | StreamRead
  - | StreamCopy
  - | StaticDraw
  - | StaticRead
  - | StaticCopy
  - | DynamicDraw
  - | DynamicRead
  - | DynamicCopy
- bufferData :: BufferTarget -> StateVar (GLsizeiptr, Ptr a, BufferUsage)
- data TransferDirection
  - = ReadFromBuffer
  - | WriteToBuffer
- bufferSubData :: BufferTarget -> TransferDirection -> GLintptr -> GLsizeiptr -> Ptr a -> IO ()
- data BufferAccess
  - = ReadOnly
  - | WriteOnly
  - | ReadWrite
- data MappingFailure
  - = MappingFailed
  - | UnmappingFailed
- withMappedBuffer :: BufferTarget -> BufferAccess -> (Ptr a -> IO b) -> (MappingFailure -> IO b) -> IO b
- mapBuffer :: BufferTarget -> BufferAccess -> IO (Maybe (Ptr a))
- unmapBuffer :: BufferTarget -> IO Bool
- bufferAccess :: BufferTarget -> GettableStateVar BufferAccess
- bufferMapped :: BufferTarget -> GettableStateVar Bool
- data BufferRangeAccessBit
  - = ReadBit
  - | WriteBit
  - | InvalidateRangeBit
  - | InvalidateBufferBit
  - | FlushExplicitBit
  - | UnsychronizedBit
- type Offset = GLintptr
- type Length = GLsizeiptr
- mapBufferRange :: BufferTarget -> Offset -> Length -> [BufferRangeAccessBit] -> IO (Maybe (Ptr a))
- flushMappedBufferRange :: BufferTarget -> Offset -> Length -> IO ()
- type BufferIndex = GLuint
- type RangeStartIndex = GLintptr
- type RangeSize = GLsizeiptr
- type BufferRange = (BufferObject, RangeStartIndex, RangeSize)
- data IndexedBufferTarget = IndexedTransformFeedBackbuffer
- bindBufferBase :: IndexedBufferTarget -> BufferIndex -> StateVar (Maybe BufferObject)
- bindBufferRange :: IndexedBufferTarget -> BufferIndex -> StateVar (Maybe BufferRange)
- indexedBufferStart :: IndexedBufferTarget -> BufferIndex -> GettableStateVar RangeStartIndex
- indexedBufferSize :: IndexedBufferTarget -> BufferIndex -> GettableStateVar RangeSize

# Object Names

module Graphics.Rendering.OpenGL.GL.ObjectName

# Buffer Objects

newtype BufferObject Source

Constructors

BufferObject GLuint |

Instances

Eq BufferObject |
Ord BufferObject |
Show BufferObject |
ObjectName BufferObject |

# Binding Buffer Objects

data BufferTarget Source

Constructors

ArrayBuffer |
CopyReadBuffer |
CopyWriteBuffer |
ElementArrayBuffer |
PixelPackBuffer |
PixelUnpackBuffer |
TransformFeedbackBuffer |

Instances

Eq BufferTarget |
Ord BufferTarget |
Show BufferTarget |

bindBuffer :: BufferTarget -> StateVar (Maybe BufferObject)Source

arrayBufferBinding :: ClientArrayType -> GettableStateVar (Maybe BufferObject)Source

vertexAttribArrayBufferBinding :: AttribLocation -> GettableStateVar (Maybe BufferObject)Source

# Handling Buffer Data

data BufferUsage Source

Constructors

StreamDraw |
StreamRead |
StreamCopy |
StaticDraw |
StaticRead |
StaticCopy |
DynamicDraw |
DynamicRead |
DynamicCopy |

Instances

Eq BufferUsage |
Ord BufferUsage |
Show BufferUsage |

bufferData :: BufferTarget -> StateVar (GLsizeiptr, Ptr a, BufferUsage)Source

data TransferDirection Source

Constructors

ReadFromBuffer |
WriteToBuffer |

Instances

Eq TransferDirection |
Ord TransferDirection |
Show TransferDirection |

bufferSubData :: BufferTarget -> TransferDirection -> GLintptr -> GLsizeiptr -> Ptr a -> IO ()Source

# Mapping Buffer Objects

data BufferAccess Source

Constructors

ReadOnly |
WriteOnly |
ReadWrite |

Instances

Eq BufferAccess |
Ord BufferAccess |
Show BufferAccess |

data MappingFailure Source

Constructors

MappingFailed |
UnmappingFailed |

Instances

Eq MappingFailure |
Ord MappingFailure |
Show MappingFailure |

withMappedBuffer :: BufferTarget -> BufferAccess -> (Ptr a -> IO b) -> (MappingFailure -> IO b) -> IO bSource

Convenience function for an exception-safe combination of `mapBuffer` and `unmapBuffer`.

mapBuffer :: BufferTarget -> BufferAccess -> IO (Maybe (Ptr a))Source

unmapBuffer :: BufferTarget -> IO Bool Source

bufferAccess :: BufferTarget -> GettableStateVar BufferAccess Source

bufferMapped :: BufferTarget -> GettableStateVar Bool Source

data BufferRangeAccessBit Source

Constructors

ReadBit |
WriteBit |
InvalidateRangeBit |
InvalidateBufferBit |
FlushExplicitBit |
UnsychronizedBit |

type Offset = GLintptr Source

type Length = GLsizeiptr Source

mapBufferRange :: BufferTarget -> Offset -> Length -> [BufferRangeAccessBit] -> IO (Maybe (Ptr a))Source

flushMappedBufferRange :: BufferTarget -> Offset -> Length -> IO ()Source

# Indexed Buffer manipulation

type BufferIndex = GLuint Source

type RangeStartIndex = GLintptr Source

type RangeSize = GLsizeiptr Source

type BufferRange = (BufferObject, RangeStartIndex, RangeSize)Source

data IndexedBufferTarget Source

Constructors

IndexedTransformFeedBackbuffer |

bindBufferBase :: IndexedBufferTarget -> BufferIndex -> StateVar (Maybe BufferObject)Source

bindBufferRange :: IndexedBufferTarget -> BufferIndex -> StateVar (Maybe BufferRange)Source

indexedBufferStart :: IndexedBufferTarget -> BufferIndex -> GettableStateVar RangeStartIndex Source

indexedBufferSize :: IndexedBufferTarget -> BufferIndex -> GettableStateVar RangeSize Source