Graphics.Rendering.OpenGL.GL.BufferObjects

OpenGL-2.13.1.0: A binding for the OpenGL graphics system

Copyright | (c) Sven Panne 2002-2013
License | BSD3
Maintainer | Sven Panne <svenpanne@gmail.com>
Stability | stable
Portability | portable
Safe Haskell | None
Language | Haskell2010

Graphics.Rendering.OpenGL.GL.BufferObjects

Contents

- 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

- data BufferObject
- data BufferTarget
  - = ArrayBuffer
  - | AtomicCounterBuffer
  - | CopyReadBuffer
  - | CopyWriteBuffer
  - | DispatchIndirectBuffer
  - | DrawIndirectBuffer
  - | ElementArrayBuffer
  - | PixelPackBuffer
  - | PixelUnpackBuffer
  - | QueryBuffer
  - | ShaderStorageBuffer
  - | TextureBuffer
  - | TransformFeedbackBuffer
  - | UniformBuffer
- 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 MapBufferUsage
  - = Read
  - | Write
  - | InvalidateRange
  - | InvalidateBuffer
  - | FlushExplicit
  - | Unsychronized
- type Offset = GLintptr
- type Length = GLsizeiptr
- mapBufferRange :: BufferTarget -> Offset -> Length -> [MapBufferUsage] -> 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
  - = IndexedAtomicCounterBuffer
  - | IndexedShaderStorageBuffer
  - | IndexedTransformFeedbackBuffer
  - | IndexedUniformBuffer
- bindBufferBase :: IndexedBufferTarget -> BufferIndex -> StateVar (Maybe BufferObject)
- bindBufferRange :: IndexedBufferTarget -> BufferIndex -> StateVar (Maybe BufferRange)
- indexedBufferStart :: IndexedBufferTarget -> BufferIndex -> GettableStateVar RangeStartIndex
- indexedBufferSize :: IndexedBufferTarget -> BufferIndex -> GettableStateVar RangeSize

# Buffer Objects

data BufferObject

Instances

Eq BufferObject |
Ord BufferObject |
Show BufferObject |
ObjectName BufferObject |
GeneratableObjectName BufferObject |
CanBeLabeled BufferObject |

# Binding Buffer Objects

data BufferTarget

Constructors

ArrayBuffer |
AtomicCounterBuffer |
CopyReadBuffer |
CopyWriteBuffer |
DispatchIndirectBuffer |
DrawIndirectBuffer |
ElementArrayBuffer |
PixelPackBuffer |
PixelUnpackBuffer |
QueryBuffer |
ShaderStorageBuffer |
TextureBuffer |
TransformFeedbackBuffer |
UniformBuffer |

Instances

Eq BufferTarget |
Ord BufferTarget |
Show BufferTarget |

bindBuffer :: BufferTarget -> StateVar (Maybe BufferObject)

arrayBufferBinding :: ClientArrayType -> GettableStateVar (Maybe BufferObject)

vertexAttribArrayBufferBinding :: AttribLocation -> GettableStateVar (Maybe BufferObject)

# Handling Buffer Data

data BufferUsage

Constructors

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

Instances

Eq BufferUsage |
Ord BufferUsage |
Show BufferUsage |

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

data TransferDirection

Constructors

ReadFromBuffer |
WriteToBuffer |

Instances

Eq TransferDirection |
Ord TransferDirection |
Show TransferDirection |

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

# Mapping Buffer Objects

data BufferAccess

Constructors

ReadOnly |
WriteOnly |
ReadWrite |

Instances

Eq BufferAccess |
Ord BufferAccess |
Show BufferAccess |

data MappingFailure

Constructors

MappingFailed |
UnmappingFailed |

Instances

Eq MappingFailure |
Ord MappingFailure |
Show MappingFailure |

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

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

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

unmapBuffer :: BufferTarget -> IO Bool

bufferAccess :: BufferTarget -> GettableStateVar BufferAccess

bufferMapped :: BufferTarget -> GettableStateVar Bool

data MapBufferUsage

Constructors

Read |
Write |
InvalidateRange |
InvalidateBuffer |
FlushExplicit |
Unsychronized |

Instances

Eq MapBufferUsage |
Ord MapBufferUsage |
Show MapBufferUsage |

type Offset = GLintptr

type Length = GLsizeiptr

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

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

# Indexed Buffer manipulation

type BufferIndex = GLuint

type RangeStartIndex = GLintptr

type RangeSize = GLsizeiptr

type BufferRange = (BufferObject, RangeStartIndex, RangeSize)

data IndexedBufferTarget

Constructors

IndexedAtomicCounterBuffer |
IndexedShaderStorageBuffer |
IndexedTransformFeedbackBuffer |
IndexedUniformBuffer |

Instances

Eq IndexedBufferTarget |
Ord IndexedBufferTarget |
Show IndexedBufferTarget |

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

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

indexedBufferStart :: IndexedBufferTarget -> BufferIndex -> GettableStateVar RangeStartIndex

indexedBufferSize :: IndexedBufferTarget -> BufferIndex -> GettableStateVar RangeSize