OpenGL-2.2.3.1: A binding for the OpenGL graphics system

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

Graphics.Rendering.OpenGL.GL.VertexArrays

Contents

- Describing Data for the Arrays
- Specifying Data for the Arrays
- Enabling Arrays
- Dereferencing and Rendering
- Generic Vertex Attribute Arrays

Description

This module corresponds to section 2.8 (Vertex Arrays) of the OpenGL 2.1 specs.

Synopsis

- type NumComponents = GLint
- data DataType
  - = UnsignedByte
  - | Byte
  - | UnsignedShort
  - | Short
  - | UnsignedInt
  - | Int
  - | HalfFloat
  - | Float
  - | UnsignedByte332
  - | UnsignedByte233Rev
  - | UnsignedShort565
  - | UnsignedShort565Rev
  - | UnsignedShort4444
  - | UnsignedShort4444Rev
  - | UnsignedShort5551
  - | UnsignedShort1555Rev
  - | UnsignedInt8888
  - | UnsignedInt8888Rev
  - | UnsignedInt1010102
  - | UnsignedInt2101010Rev
  - | UnsignedInt248
  - | UnsignedInt10f11f11fRev
  - | UnsignedInt5999Rev
  - | Float32UnsignedInt248Rev
  - | Bitmap
  - | UnsignedShort88
  - | UnsignedShort88Rev
  - | Double
  - | TwoBytes
  - | ThreeBytes
  - | FourBytes
- type Stride = GLsizei
- data VertexArrayDescriptor a = VertexArrayDescriptor !NumComponents !DataType !Stride !(Ptr a)
- data ClientArrayType
  - = VertexArray
  - | NormalArray
  - | ColorArray
  - | IndexArray
  - | TextureCoordArray
  - | EdgeFlagArray
  - | FogCoordArray
  - | SecondaryColorArray
  - | MatrixIndexArray
- arrayPointer :: ClientArrayType -> StateVar (VertexArrayDescriptor a)
- data InterleavedArrays
  - = V2f
  - | V3f
  - | C4ubV2f
  - | C4ubV3f
  - | C3fV3f
  - | N3fV3f
  - | C4fN3fV3f
  - | T2fV3f
  - | T4fV4f
  - | T2fC4ubV3f
  - | T2fC3fV3f
  - | T2fN3fV3f
  - | T2fC4fN3fV3f
  - | T4fC4fN3fV4f
- interleavedArrays :: InterleavedArrays -> Stride -> Ptr a -> IO ()
- clientState :: ClientArrayType -> StateVar Capability
- clientActiveTexture :: StateVar TextureUnit
- type ArrayIndex = GLint
- type NumArrayIndices = GLsizei
- type NumIndexBlocks = GLsizei
- arrayElement :: ArrayIndex -> IO ()
- drawArrays :: PrimitiveMode -> ArrayIndex -> NumArrayIndices -> IO ()
- multiDrawArrays :: PrimitiveMode -> Ptr ArrayIndex -> Ptr NumArrayIndices -> NumIndexBlocks -> IO ()
- drawElements :: PrimitiveMode -> NumArrayIndices -> DataType -> Ptr a -> IO ()
- multiDrawElements :: PrimitiveMode -> Ptr NumArrayIndices -> DataType -> Ptr (Ptr a) -> NumIndexBlocks -> IO ()
- drawRangeElements :: PrimitiveMode -> (ArrayIndex, ArrayIndex) -> NumArrayIndices -> DataType -> Ptr a -> IO ()
- maxElementsVertices :: GettableStateVar NumArrayIndices
- maxElementsIndices :: GettableStateVar NumArrayIndices
- lockArrays :: StateVar (Maybe (ArrayIndex, NumArrayIndices))
- primitiveRestartIndex :: StateVar (Maybe ArrayIndex)
- vertexAttribPointer :: AttribLocation -> StateVar (IntegerHandling, VertexArrayDescriptor a)
- vertexAttribArray :: AttribLocation -> StateVar Capability

# Describing Data for the Arrays

type NumComponents = GLint

data DataType

Constructors

UnsignedByte |
Byte |
UnsignedShort |
Short |
UnsignedInt |
Int |
HalfFloat |
Float |
UnsignedByte332 |
UnsignedByte233Rev |
UnsignedShort565 |
UnsignedShort565Rev |
UnsignedShort4444 |
UnsignedShort4444Rev |
UnsignedShort5551 |
UnsignedShort1555Rev |
UnsignedInt8888 |
UnsignedInt8888Rev |
UnsignedInt1010102 |
UnsignedInt2101010Rev |
UnsignedInt248 |
UnsignedInt10f11f11fRev |
UnsignedInt5999Rev |
Float32UnsignedInt248Rev |
Bitmap |
UnsignedShort88 |
UnsignedShort88Rev |
Double |
TwoBytes |
ThreeBytes |
FourBytes |

Instances

Eq DataType |
Ord DataType |
Show DataType |

type Stride = GLsizei

data VertexArrayDescriptor a

Constructors

VertexArrayDescriptor !NumComponents !DataType !Stride !(Ptr a) |

Instances

Eq (VertexArrayDescriptor a) |
Ord (VertexArrayDescriptor a) |
Show (VertexArrayDescriptor a) |

# Specifying Data for the Arrays

data ClientArrayType

Constructors

VertexArray |
NormalArray |
ColorArray |
IndexArray |
TextureCoordArray |
EdgeFlagArray |
FogCoordArray |
SecondaryColorArray |
MatrixIndexArray |

Instances

Eq ClientArrayType |
Ord ClientArrayType |
Show ClientArrayType |

arrayPointer :: ClientArrayType -> StateVar (VertexArrayDescriptor a)

data InterleavedArrays

Constructors

V2f |
V3f |
C4ubV2f |
C4ubV3f |
C3fV3f |
N3fV3f |
C4fN3fV3f |
T2fV3f |
T4fV4f |
T2fC4ubV3f |
T2fC3fV3f |
T2fN3fV3f |
T2fC4fN3fV3f |
T4fC4fN3fV4f |

Instances

Eq InterleavedArrays |
Ord InterleavedArrays |
Show InterleavedArrays |

interleavedArrays :: InterleavedArrays -> Stride -> Ptr a -> IO ()

# Enabling Arrays

clientState :: ClientArrayType -> StateVar Capability

clientActiveTexture :: StateVar TextureUnit

# Dereferencing and Rendering

type ArrayIndex = GLint

type NumArrayIndices = GLsizei

type NumIndexBlocks = GLsizei

arrayElement :: ArrayIndex -> IO ()

drawArrays :: PrimitiveMode -> ArrayIndex -> NumArrayIndices -> IO ()

multiDrawArrays :: PrimitiveMode -> Ptr ArrayIndex -> Ptr NumArrayIndices -> NumIndexBlocks -> IO ()

drawElements :: PrimitiveMode -> NumArrayIndices -> DataType -> Ptr a -> IO ()

multiDrawElements :: PrimitiveMode -> Ptr NumArrayIndices -> DataType -> Ptr (Ptr a) -> NumIndexBlocks -> IO ()

drawRangeElements :: PrimitiveMode -> (ArrayIndex, ArrayIndex) -> NumArrayIndices -> DataType -> Ptr a -> IO ()

maxElementsVertices :: GettableStateVar NumArrayIndices

maxElementsIndices :: GettableStateVar NumArrayIndices

lockArrays :: StateVar (Maybe (ArrayIndex, NumArrayIndices))

primitiveRestartIndex :: StateVar (Maybe ArrayIndex)

# Generic Vertex Attribute Arrays

vertexAttribPointer :: AttribLocation -> StateVar (IntegerHandling, VertexArrayDescriptor a)

vertexAttribArray :: AttribLocation -> StateVar Capability