OpenGL-3.0.3.0: A binding for the OpenGL graphics system

Copyright | (c) Sven Panne 2002-2019
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 Source #

#### Instances

Instances details

GeneratableObjectName BufferObject Source # |
Instance details Defined in Graphics.Rendering.OpenGL.GL.BufferObjects Methods genObjectName :: MonadIO m => m BufferObject Source # genObjectNames :: MonadIO m => Int -> m [BufferObject] Source #
ObjectName BufferObject Source # |
Instance details Defined in Graphics.Rendering.OpenGL.GL.BufferObjects Methods isObjectName :: MonadIO m => BufferObject -> m Bool Source # deleteObjectName :: MonadIO m => BufferObject -> m () Source # deleteObjectNames :: MonadIO m => [BufferObject] -> m () Source #
CanBeLabeled BufferObject Source # |
Instance details Defined in Graphics.Rendering.OpenGL.GL.BufferObjects Methods objectLabel :: BufferObject -> StateVar (Maybe String) Source #
Show BufferObject Source # |
Instance details Defined in Graphics.Rendering.OpenGL.GL.BufferObjects Methods showsPrec :: Int -> BufferObject -> ShowS Source # show :: BufferObject -> String Source # showList :: [BufferObject] -> ShowS Source #
Eq BufferObject Source # |
Instance details Defined in Graphics.Rendering.OpenGL.GL.BufferObjects Methods (==) :: BufferObject -> BufferObject -> Bool Source # (/=) :: BufferObject -> BufferObject -> Bool Source #
Ord BufferObject Source # |

Instance details

Defined in Graphics.Rendering.OpenGL.GL.BufferObjects

Methods

compare :: BufferObject -> BufferObject -> Ordering Source #

(<) :: BufferObject -> BufferObject -> Bool Source #

(<=) :: BufferObject -> BufferObject -> Bool Source #

(>) :: BufferObject -> BufferObject -> Bool Source #

(>=) :: BufferObject -> BufferObject -> Bool Source #

max :: BufferObject -> BufferObject -> BufferObject Source #

min :: BufferObject -> BufferObject -> BufferObject Source #

# Binding Buffer Objects

data BufferTarget Source #

Constructors

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

#### Instances

Instances details

Show BufferTarget Source # |
Instance details Defined in Graphics.Rendering.OpenGL.GL.BufferObjects Methods showsPrec :: Int -> BufferTarget -> ShowS Source # show :: BufferTarget -> String Source # showList :: [BufferTarget] -> ShowS Source #
Eq BufferTarget Source # |
Instance details Defined in Graphics.Rendering.OpenGL.GL.BufferObjects Methods (==) :: BufferTarget -> BufferTarget -> Bool Source # (/=) :: BufferTarget -> BufferTarget -> Bool Source #
Ord BufferTarget Source # |

Instance details

Defined in Graphics.Rendering.OpenGL.GL.BufferObjects

Methods

compare :: BufferTarget -> BufferTarget -> Ordering Source #

(<) :: BufferTarget -> BufferTarget -> Bool Source #

(<=) :: BufferTarget -> BufferTarget -> Bool Source #

(>) :: BufferTarget -> BufferTarget -> Bool Source #

(>=) :: BufferTarget -> BufferTarget -> Bool Source #

max :: BufferTarget -> BufferTarget -> BufferTarget Source #

min :: BufferTarget -> BufferTarget -> BufferTarget Source #

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

Instances details

Show BufferUsage Source # |
Instance details Defined in Graphics.Rendering.OpenGL.GL.BufferObjects Methods showsPrec :: Int -> BufferUsage -> ShowS Source # show :: BufferUsage -> String Source # showList :: [BufferUsage] -> ShowS Source #
Eq BufferUsage Source # |
Instance details Defined in Graphics.Rendering.OpenGL.GL.BufferObjects Methods (==) :: BufferUsage -> BufferUsage -> Bool Source # (/=) :: BufferUsage -> BufferUsage -> Bool Source #
Ord BufferUsage Source # |

Instance details

Defined in Graphics.Rendering.OpenGL.GL.BufferObjects

Methods

compare :: BufferUsage -> BufferUsage -> Ordering Source #

(<) :: BufferUsage -> BufferUsage -> Bool Source #

(<=) :: BufferUsage -> BufferUsage -> Bool Source #

(>) :: BufferUsage -> BufferUsage -> Bool Source #

(>=) :: BufferUsage -> BufferUsage -> Bool Source #

max :: BufferUsage -> BufferUsage -> BufferUsage Source #

min :: BufferUsage -> BufferUsage -> BufferUsage Source #

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

data TransferDirection Source #

Constructors

ReadFromBuffer |
WriteToBuffer |

#### Instances

Instances details

Show TransferDirection Source # |
Instance details Defined in Graphics.Rendering.OpenGL.GL.BufferObjects Methods showsPrec :: Int -> TransferDirection -> ShowS Source # show :: TransferDirection -> String Source # showList :: [TransferDirection] -> ShowS Source #
Eq TransferDirection Source # |
Instance details Defined in Graphics.Rendering.OpenGL.GL.BufferObjects Methods (==) :: TransferDirection -> TransferDirection -> Bool Source # (/=) :: TransferDirection -> TransferDirection -> Bool Source #
Ord TransferDirection Source # |

Instance details

Defined in Graphics.Rendering.OpenGL.GL.BufferObjects

Methods

compare :: TransferDirection -> TransferDirection -> Ordering Source #

(<) :: TransferDirection -> TransferDirection -> Bool Source #

(<=) :: TransferDirection -> TransferDirection -> Bool Source #

(>) :: TransferDirection -> TransferDirection -> Bool Source #

(>=) :: TransferDirection -> TransferDirection -> Bool Source #

max :: TransferDirection -> TransferDirection -> TransferDirection Source #

min :: TransferDirection -> TransferDirection -> TransferDirection Source #

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

# Mapping Buffer Objects

data BufferAccess Source #

Constructors

ReadOnly |
WriteOnly |
ReadWrite |

#### Instances

Instances details

Show BufferAccess Source # |
Instance details Defined in Graphics.Rendering.OpenGL.GL.BufferObjects Methods showsPrec :: Int -> BufferAccess -> ShowS Source # show :: BufferAccess -> String Source # showList :: [BufferAccess] -> ShowS Source #
Eq BufferAccess Source # |
Instance details Defined in Graphics.Rendering.OpenGL.GL.BufferObjects Methods (==) :: BufferAccess -> BufferAccess -> Bool Source # (/=) :: BufferAccess -> BufferAccess -> Bool Source #
Ord BufferAccess Source # |

Instance details

Defined in Graphics.Rendering.OpenGL.GL.BufferObjects

Methods

compare :: BufferAccess -> BufferAccess -> Ordering Source #

(<) :: BufferAccess -> BufferAccess -> Bool Source #

(<=) :: BufferAccess -> BufferAccess -> Bool Source #

(>) :: BufferAccess -> BufferAccess -> Bool Source #

(>=) :: BufferAccess -> BufferAccess -> Bool Source #

max :: BufferAccess -> BufferAccess -> BufferAccess Source #

min :: BufferAccess -> BufferAccess -> BufferAccess Source #

data MappingFailure Source #

Constructors

MappingFailed |
UnmappingFailed |

#### Instances

Instances details

Show MappingFailure Source # |
Instance details Defined in Graphics.Rendering.OpenGL.GL.BufferObjects Methods showsPrec :: Int -> MappingFailure -> ShowS Source # show :: MappingFailure -> String Source # showList :: [MappingFailure] -> ShowS Source #
Eq MappingFailure Source # |
Instance details Defined in Graphics.Rendering.OpenGL.GL.BufferObjects Methods (==) :: MappingFailure -> MappingFailure -> Bool Source # (/=) :: MappingFailure -> MappingFailure -> Bool Source #
Ord MappingFailure Source # |

Instance details

Defined in Graphics.Rendering.OpenGL.GL.BufferObjects

Methods

compare :: MappingFailure -> MappingFailure -> Ordering Source #

(<) :: MappingFailure -> MappingFailure -> Bool Source #

(<=) :: MappingFailure -> MappingFailure -> Bool Source #

(>) :: MappingFailure -> MappingFailure -> Bool Source #

(>=) :: MappingFailure -> MappingFailure -> Bool Source #

max :: MappingFailure -> MappingFailure -> MappingFailure Source #

min :: MappingFailure -> MappingFailure -> MappingFailure Source #

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

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 MapBufferUsage Source #

Constructors

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

#### Instances

Instances details

Show MapBufferUsage Source # |
Instance details Defined in Graphics.Rendering.OpenGL.GL.BufferObjects Methods showsPrec :: Int -> MapBufferUsage -> ShowS Source # show :: MapBufferUsage -> String Source # showList :: [MapBufferUsage] -> ShowS Source #
Eq MapBufferUsage Source # |
Instance details Defined in Graphics.Rendering.OpenGL.GL.BufferObjects Methods (==) :: MapBufferUsage -> MapBufferUsage -> Bool Source # (/=) :: MapBufferUsage -> MapBufferUsage -> Bool Source #
Ord MapBufferUsage Source # |

Instance details

Defined in Graphics.Rendering.OpenGL.GL.BufferObjects

Methods

compare :: MapBufferUsage -> MapBufferUsage -> Ordering Source #

(<) :: MapBufferUsage -> MapBufferUsage -> Bool Source #

(<=) :: MapBufferUsage -> MapBufferUsage -> Bool Source #

(>) :: MapBufferUsage -> MapBufferUsage -> Bool Source #

(>=) :: MapBufferUsage -> MapBufferUsage -> Bool Source #

max :: MapBufferUsage -> MapBufferUsage -> MapBufferUsage Source #

min :: MapBufferUsage -> MapBufferUsage -> MapBufferUsage Source #

type Offset = GLintptr Source #

type Length = GLsizeiptr Source #

mapBufferRange :: BufferTarget -> Offset -> Length -> [MapBufferUsage] -> 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

IndexedAtomicCounterBuffer |
IndexedShaderStorageBuffer |
IndexedTransformFeedbackBuffer |
IndexedUniformBuffer |

#### Instances

Instances details

Show IndexedBufferTarget Source # |
Instance details Defined in Graphics.Rendering.OpenGL.GL.BufferObjects Methods showsPrec :: Int -> IndexedBufferTarget -> ShowS Source # show :: IndexedBufferTarget -> String Source # showList :: [IndexedBufferTarget] -> ShowS Source #
Eq IndexedBufferTarget Source # |
Instance details Defined in Graphics.Rendering.OpenGL.GL.BufferObjects Methods (==) :: IndexedBufferTarget -> IndexedBufferTarget -> Bool Source # (/=) :: IndexedBufferTarget -> IndexedBufferTarget -> Bool Source #
Ord IndexedBufferTarget Source # |

Instance details

Defined in Graphics.Rendering.OpenGL.GL.BufferObjects

Methods

compare :: IndexedBufferTarget -> IndexedBufferTarget -> Ordering Source #

(<) :: IndexedBufferTarget -> IndexedBufferTarget -> Bool Source #

(<=) :: IndexedBufferTarget -> IndexedBufferTarget -> Bool Source #

(>) :: IndexedBufferTarget -> IndexedBufferTarget -> Bool Source #

(>=) :: IndexedBufferTarget -> IndexedBufferTarget -> Bool Source #

max :: IndexedBufferTarget -> IndexedBufferTarget -> IndexedBufferTarget Source #

min :: IndexedBufferTarget -> IndexedBufferTarget -> IndexedBufferTarget Source #

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 #