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.Evaluators

Contents

- Evaluator-related Types
- Defining Evaluator Maps
  - One-dimensional Evaluator Maps
  - Two-dimensional Evaluator Maps
- Using Evaluator Maps
  - Evaluating an Arbitrary Coordinate Value
  - Using Evenly Spaced Coordinate Values
    - Defining a Grid
    - Evaluating a Whole Mesh
    - Evaluating a Single Point on a Mesh
- Normal Generation

Description

This module corresponds to section 5.1 (Evaluators) of the OpenGL 2.1 specs.

Synopsis

- type Order = GLint
- maxOrder :: GettableStateVar Order
- class Storable d => Domain d
- data MapDescriptor d = MapDescriptor (d, d) Stride Order NumComponents
- class ControlPoint (c :: Type -> Type)
- class Map1 (m :: (Type -> Type) -> Type -> Type) where
  - withNewMap1 :: forall (c :: Type -> Type) d. (ControlPoint c, Domain d) => MapDescriptor d -> (Ptr d -> IO ()) -> IO (m c d)
  - withMap1 :: forall (c :: Type -> Type) d a. (ControlPoint c, Domain d) => m c d -> (MapDescriptor d -> Ptr d -> IO a) -> IO a
  - newMap1 :: (ControlPoint c, Domain d) => (d, d) -> [c d] -> IO (m c d)
  - getMap1Components :: (ControlPoint c, Domain d) => m c d -> IO ((d, d), [c d])
- data GLmap1 (c :: Type -> Type) d
- map1 :: forall m (c :: Type -> Type) d. (Map1 m, ControlPoint c, Domain d) => StateVar (Maybe (m c d))
- class Map2 (m :: (Type -> Type) -> Type -> Type) where
  - withNewMap2 :: forall (c :: Type -> Type) d. (ControlPoint c, Domain d) => MapDescriptor d -> MapDescriptor d -> (Ptr d -> IO ()) -> IO (m c d)
  - withMap2 :: forall (c :: Type -> Type) d a. (ControlPoint c, Domain d) => m c d -> (MapDescriptor d -> MapDescriptor d -> Ptr d -> IO a) -> IO a
  - newMap2 :: (ControlPoint c, Domain d) => (d, d) -> (d, d) -> [[c d]] -> IO (m c d)
  - getMap2Components :: (ControlPoint c, Domain d) => m c d -> IO ((d, d), (d, d), [[c d]])
- data GLmap2 (c :: Type -> Type) d
- map2 :: forall m (c :: Type -> Type) d. (Map2 m, ControlPoint c, Domain d) => StateVar (Maybe (m c d))
- evalCoord1 :: Domain d => d -> IO ()
- evalCoord1v :: Domain d => Ptr d -> IO ()
- evalCoord2 :: Domain d => (d, d) -> IO ()
- evalCoord2v :: Domain d => Ptr d -> IO ()
- mapGrid1 :: Domain d => StateVar (GLint, (d, d))
- mapGrid2 :: Domain d => StateVar ((GLint, (d, d)), (GLint, (d, d)))
- evalMesh1 :: PolygonMode -> (GLint, GLint) -> IO ()
- evalMesh2 :: PolygonMode -> (GLint, GLint) -> (GLint, GLint) -> IO ()
- evalPoint1 :: GLint -> IO ()
- evalPoint2 :: (GLint, GLint) -> IO ()
- autoNormal :: StateVar Capability

# Evaluator-related Types

type Order = GLint Source #

maxOrder :: GettableStateVar Order Source #

class Storable d => Domain d Source #

Minimal complete definition

glMap1, glMap2, glGetMapv, evalCoord1, evalCoord1v, evalCoord2, evalCoord2v, glMapGrid1, glMapGrid2, get2, get4

#### Instances

Instances details

Domain GLdouble Source # |

Instance details

Defined in Graphics.Rendering.OpenGL.GL.Domain

Methods

glMap1 :: GLenum -> GLdouble -> GLdouble -> GLint -> GLint -> Ptr GLdouble -> IO ()

glMap2 :: GLenum -> GLdouble -> GLdouble -> GLint -> GLint -> GLdouble -> GLdouble -> GLint -> GLint -> Ptr GLdouble -> IO ()

glGetMapv :: GLenum -> GLenum -> Ptr GLdouble -> IO ()

evalCoord1 :: GLdouble -> IO () Source #

evalCoord1v :: Ptr GLdouble -> IO () Source #

evalCoord2 :: (GLdouble, GLdouble) -> IO () Source #

evalCoord2v :: Ptr GLdouble -> IO () Source #

glMapGrid1 :: GLint -> GLdouble -> GLdouble -> IO ()

glMapGrid2 :: GLint -> GLdouble -> GLdouble -> GLint -> GLdouble -> GLdouble -> IO ()

get2 :: GetPName2F p => (GLdouble -> GLdouble -> a) -> p -> IO a

get4 :: GetPName4F p => (GLdouble -> GLdouble -> GLdouble -> GLdouble -> a) -> p -> IO a

Domain GLfloat Source # |

Instance details

Defined in Graphics.Rendering.OpenGL.GL.Domain

Methods

glMap1 :: GLenum -> GLfloat -> GLfloat -> GLint -> GLint -> Ptr GLfloat -> IO ()

glMap2 :: GLenum -> GLfloat -> GLfloat -> GLint -> GLint -> GLfloat -> GLfloat -> GLint -> GLint -> Ptr GLfloat -> IO ()

glGetMapv :: GLenum -> GLenum -> Ptr GLfloat -> IO ()

evalCoord1 :: GLfloat -> IO () Source #

evalCoord1v :: Ptr GLfloat -> IO () Source #

evalCoord2 :: (GLfloat, GLfloat) -> IO () Source #

evalCoord2v :: Ptr GLfloat -> IO () Source #

glMapGrid1 :: GLint -> GLfloat -> GLfloat -> IO ()

glMapGrid2 :: GLint -> GLfloat -> GLfloat -> GLint -> GLfloat -> GLfloat -> IO ()

get2 :: GetPName2F p => (GLfloat -> GLfloat -> a) -> p -> IO a

get4 :: GetPName4F p => (GLfloat -> GLfloat -> GLfloat -> GLfloat -> a) -> p -> IO a

data MapDescriptor d Source #

Constructors

MapDescriptor (d, d) Stride Order NumComponents |

#### Instances

Instances details

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

Instance details

Defined in Graphics.Rendering.OpenGL.GL.Evaluators

Methods

compare :: MapDescriptor d -> MapDescriptor d -> Ordering Source #

(<) :: MapDescriptor d -> MapDescriptor d -> Bool Source #

(<=) :: MapDescriptor d -> MapDescriptor d -> Bool Source #

(>) :: MapDescriptor d -> MapDescriptor d -> Bool Source #

(>=) :: MapDescriptor d -> MapDescriptor d -> Bool Source #

max :: MapDescriptor d -> MapDescriptor d -> MapDescriptor d Source #

min :: MapDescriptor d -> MapDescriptor d -> MapDescriptor d Source #

class ControlPoint (c :: Type -> Type) Source #

Minimal complete definition

map1Target, map2Target, enableCap1, enableCap2, numComponents, peekControlPoint, pokeControlPoint

#### Instances

Instances details

ControlPoint Vertex3 Source # |

Instance details

Defined in Graphics.Rendering.OpenGL.GL.ControlPoint

Methods

map1Target :: Domain d => Vertex3 d -> GLenum

map2Target :: Domain d => Vertex3 d -> GLenum

enableCap1 :: Domain d => Vertex3 d -> EnableCap

enableCap2 :: Domain d => Vertex3 d -> EnableCap

numComponents :: Domain d => Vertex3 d -> Stride

peekControlPoint :: Domain d => Ptr (Vertex3 d) -> IO (Vertex3 d)

pokeControlPoint :: Domain d => Ptr (Vertex3 d) -> Vertex3 d -> IO ()

ControlPoint Vertex4 Source # |

Instance details

Defined in Graphics.Rendering.OpenGL.GL.ControlPoint

Methods

map1Target :: Domain d => Vertex4 d -> GLenum

map2Target :: Domain d => Vertex4 d -> GLenum

enableCap1 :: Domain d => Vertex4 d -> EnableCap

enableCap2 :: Domain d => Vertex4 d -> EnableCap

numComponents :: Domain d => Vertex4 d -> Stride

peekControlPoint :: Domain d => Ptr (Vertex4 d) -> IO (Vertex4 d)

pokeControlPoint :: Domain d => Ptr (Vertex4 d) -> Vertex4 d -> IO ()

ControlPoint Color4 Source # |

Instance details

Defined in Graphics.Rendering.OpenGL.GL.ControlPoint

Methods

map1Target :: Domain d => Color4 d -> GLenum

map2Target :: Domain d => Color4 d -> GLenum

enableCap1 :: Domain d => Color4 d -> EnableCap

enableCap2 :: Domain d => Color4 d -> EnableCap

numComponents :: Domain d => Color4 d -> Stride

peekControlPoint :: Domain d => Ptr (Color4 d) -> IO (Color4 d)

pokeControlPoint :: Domain d => Ptr (Color4 d) -> Color4 d -> IO ()

ControlPoint Index1 Source # |

Instance details

Defined in Graphics.Rendering.OpenGL.GL.ControlPoint

Methods

map1Target :: Domain d => Index1 d -> GLenum

map2Target :: Domain d => Index1 d -> GLenum

enableCap1 :: Domain d => Index1 d -> EnableCap

enableCap2 :: Domain d => Index1 d -> EnableCap

numComponents :: Domain d => Index1 d -> Stride

peekControlPoint :: Domain d => Ptr (Index1 d) -> IO (Index1 d)

pokeControlPoint :: Domain d => Ptr (Index1 d) -> Index1 d -> IO ()

ControlPoint Normal3 Source # |

Instance details

Defined in Graphics.Rendering.OpenGL.GL.ControlPoint

Methods

map1Target :: Domain d => Normal3 d -> GLenum

map2Target :: Domain d => Normal3 d -> GLenum

enableCap1 :: Domain d => Normal3 d -> EnableCap

enableCap2 :: Domain d => Normal3 d -> EnableCap

numComponents :: Domain d => Normal3 d -> Stride

peekControlPoint :: Domain d => Ptr (Normal3 d) -> IO (Normal3 d)

pokeControlPoint :: Domain d => Ptr (Normal3 d) -> Normal3 d -> IO ()

ControlPoint TexCoord1 Source # |

Instance details

Defined in Graphics.Rendering.OpenGL.GL.ControlPoint

Methods

map1Target :: Domain d => TexCoord1 d -> GLenum

map2Target :: Domain d => TexCoord1 d -> GLenum

enableCap1 :: Domain d => TexCoord1 d -> EnableCap

enableCap2 :: Domain d => TexCoord1 d -> EnableCap

numComponents :: Domain d => TexCoord1 d -> Stride

peekControlPoint :: Domain d => Ptr (TexCoord1 d) -> IO (TexCoord1 d)

pokeControlPoint :: Domain d => Ptr (TexCoord1 d) -> TexCoord1 d -> IO ()

ControlPoint TexCoord2 Source # |

Instance details

Defined in Graphics.Rendering.OpenGL.GL.ControlPoint

Methods

map1Target :: Domain d => TexCoord2 d -> GLenum

map2Target :: Domain d => TexCoord2 d -> GLenum

enableCap1 :: Domain d => TexCoord2 d -> EnableCap

enableCap2 :: Domain d => TexCoord2 d -> EnableCap

numComponents :: Domain d => TexCoord2 d -> Stride

peekControlPoint :: Domain d => Ptr (TexCoord2 d) -> IO (TexCoord2 d)

pokeControlPoint :: Domain d => Ptr (TexCoord2 d) -> TexCoord2 d -> IO ()

ControlPoint TexCoord3 Source # |

Instance details

Defined in Graphics.Rendering.OpenGL.GL.ControlPoint

Methods

map1Target :: Domain d => TexCoord3 d -> GLenum

map2Target :: Domain d => TexCoord3 d -> GLenum

enableCap1 :: Domain d => TexCoord3 d -> EnableCap

enableCap2 :: Domain d => TexCoord3 d -> EnableCap

numComponents :: Domain d => TexCoord3 d -> Stride

peekControlPoint :: Domain d => Ptr (TexCoord3 d) -> IO (TexCoord3 d)

pokeControlPoint :: Domain d => Ptr (TexCoord3 d) -> TexCoord3 d -> IO ()

ControlPoint TexCoord4 Source # |

Instance details

Defined in Graphics.Rendering.OpenGL.GL.ControlPoint

Methods

map1Target :: Domain d => TexCoord4 d -> GLenum

map2Target :: Domain d => TexCoord4 d -> GLenum

enableCap1 :: Domain d => TexCoord4 d -> EnableCap

enableCap2 :: Domain d => TexCoord4 d -> EnableCap

numComponents :: Domain d => TexCoord4 d -> Stride

peekControlPoint :: Domain d => Ptr (TexCoord4 d) -> IO (TexCoord4 d)

pokeControlPoint :: Domain d => Ptr (TexCoord4 d) -> TexCoord4 d -> IO ()

# Defining Evaluator Maps

## One-dimensional Evaluator Maps

class Map1 (m :: (Type -> Type) -> Type -> Type) where Source #

Minimal complete definition

Nothing

Methods

withNewMap1 :: forall (c :: Type -> Type) d. (ControlPoint c, Domain d) => MapDescriptor d -> (Ptr d -> IO ()) -> IO (m c d) Source #

withMap1 :: forall (c :: Type -> Type) d a. (ControlPoint c, Domain d) => m c d -> (MapDescriptor d -> Ptr d -> IO a) -> IO a Source #

newMap1 :: (ControlPoint c, Domain d) => (d, d) -> [c d] -> IO (m c d) Source #

getMap1Components :: (ControlPoint c, Domain d) => m c d -> IO ((d, d), [c d]) Source #

#### Instances

Instances details

Map1 GLmap1 Source # |

Instance details

Defined in Graphics.Rendering.OpenGL.GL.Evaluators

Methods

withNewMap1 :: forall (c :: Type -> Type) d. (ControlPoint c, Domain d) => MapDescriptor d -> (Ptr d -> IO ()) -> IO (GLmap1 c d) Source #

withMap1 :: forall (c :: Type -> Type) d a. (ControlPoint c, Domain d) => GLmap1 c d -> (MapDescriptor d -> Ptr d -> IO a) -> IO a Source #

newMap1 :: (ControlPoint c, Domain d) => (d, d) -> [c d] -> IO (GLmap1 c d) Source #

getMap1Components :: (ControlPoint c, Domain d) => GLmap1 c d -> IO ((d, d), [c d]) Source #

data GLmap1 (c :: Type -> Type) d Source #

#### Instances

Instances details

Map1 GLmap1 Source # |

Instance details

Defined in Graphics.Rendering.OpenGL.GL.Evaluators

Methods

withNewMap1 :: forall (c :: Type -> Type) d. (ControlPoint c, Domain d) => MapDescriptor d -> (Ptr d -> IO ()) -> IO (GLmap1 c d) Source #

withMap1 :: forall (c :: Type -> Type) d a. (ControlPoint c, Domain d) => GLmap1 c d -> (MapDescriptor d -> Ptr d -> IO a) -> IO a Source #

newMap1 :: (ControlPoint c, Domain d) => (d, d) -> [c d] -> IO (GLmap1 c d) Source #

getMap1Components :: (ControlPoint c, Domain d) => GLmap1 c d -> IO ((d, d), [c d]) Source #

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

Instance details

Defined in Graphics.Rendering.OpenGL.GL.Evaluators

Methods

compare :: GLmap1 c d -> GLmap1 c d -> Ordering Source #

(<) :: GLmap1 c d -> GLmap1 c d -> Bool Source #

(<=) :: GLmap1 c d -> GLmap1 c d -> Bool Source #

(>) :: GLmap1 c d -> GLmap1 c d -> Bool Source #

(>=) :: GLmap1 c d -> GLmap1 c d -> Bool Source #

max :: GLmap1 c d -> GLmap1 c d -> GLmap1 c d Source #

min :: GLmap1 c d -> GLmap1 c d -> GLmap1 c d Source #

map1 :: forall m (c :: Type -> Type) d. (Map1 m, ControlPoint c, Domain d) => StateVar (Maybe (m c d)) Source #

## Two-dimensional Evaluator Maps

class Map2 (m :: (Type -> Type) -> Type -> Type) where Source #

Minimal complete definition

Nothing

Methods

withNewMap2 :: forall (c :: Type -> Type) d. (ControlPoint c, Domain d) => MapDescriptor d -> MapDescriptor d -> (Ptr d -> IO ()) -> IO (m c d) Source #

withMap2 :: forall (c :: Type -> Type) d a. (ControlPoint c, Domain d) => m c d -> (MapDescriptor d -> MapDescriptor d -> Ptr d -> IO a) -> IO a Source #

newMap2 :: (ControlPoint c, Domain d) => (d, d) -> (d, d) -> [[c d]] -> IO (m c d) Source #

getMap2Components :: (ControlPoint c, Domain d) => m c d -> IO ((d, d), (d, d), [[c d]]) Source #

#### Instances

Instances details

Map2 GLmap2 Source # |

Instance details

Defined in Graphics.Rendering.OpenGL.GL.Evaluators

Methods

withNewMap2 :: forall (c :: Type -> Type) d. (ControlPoint c, Domain d) => MapDescriptor d -> MapDescriptor d -> (Ptr d -> IO ()) -> IO (GLmap2 c d) Source #

withMap2 :: forall (c :: Type -> Type) d a. (ControlPoint c, Domain d) => GLmap2 c d -> (MapDescriptor d -> MapDescriptor d -> Ptr d -> IO a) -> IO a Source #

newMap2 :: (ControlPoint c, Domain d) => (d, d) -> (d, d) -> [[c d]] -> IO (GLmap2 c d) Source #

getMap2Components :: (ControlPoint c, Domain d) => GLmap2 c d -> IO ((d, d), (d, d), [[c d]]) Source #

data GLmap2 (c :: Type -> Type) d Source #

#### Instances

Instances details

Map2 GLmap2 Source # |

Instance details

Defined in Graphics.Rendering.OpenGL.GL.Evaluators

Methods

withNewMap2 :: forall (c :: Type -> Type) d. (ControlPoint c, Domain d) => MapDescriptor d -> MapDescriptor d -> (Ptr d -> IO ()) -> IO (GLmap2 c d) Source #

withMap2 :: forall (c :: Type -> Type) d a. (ControlPoint c, Domain d) => GLmap2 c d -> (MapDescriptor d -> MapDescriptor d -> Ptr d -> IO a) -> IO a Source #

newMap2 :: (ControlPoint c, Domain d) => (d, d) -> (d, d) -> [[c d]] -> IO (GLmap2 c d) Source #

getMap2Components :: (ControlPoint c, Domain d) => GLmap2 c d -> IO ((d, d), (d, d), [[c d]]) Source #

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

Instance details

Defined in Graphics.Rendering.OpenGL.GL.Evaluators

Methods

compare :: GLmap2 c d -> GLmap2 c d -> Ordering Source #

(<) :: GLmap2 c d -> GLmap2 c d -> Bool Source #

(<=) :: GLmap2 c d -> GLmap2 c d -> Bool Source #

(>) :: GLmap2 c d -> GLmap2 c d -> Bool Source #

(>=) :: GLmap2 c d -> GLmap2 c d -> Bool Source #

max :: GLmap2 c d -> GLmap2 c d -> GLmap2 c d Source #

min :: GLmap2 c d -> GLmap2 c d -> GLmap2 c d Source #

map2 :: forall m (c :: Type -> Type) d. (Map2 m, ControlPoint c, Domain d) => StateVar (Maybe (m c d)) Source #

# Using Evaluator Maps

## Evaluating an Arbitrary Coordinate Value

evalCoord1 :: Domain d => d -> IO () Source #

evalCoord1v :: Domain d => Ptr d -> IO () Source #

evalCoord2 :: Domain d => (d, d) -> IO () Source #

evalCoord2v :: Domain d => Ptr d -> IO () Source #

## Using Evenly Spaced Coordinate Values

### Defining a Grid

mapGrid1 :: Domain d => StateVar (GLint, (d, d)) Source #

mapGrid2 :: Domain d => StateVar ((GLint, (d, d)), (GLint, (d, d))) Source #

### Evaluating a Whole Mesh

evalMesh1 :: PolygonMode -> (GLint, GLint) -> IO () Source #

evalMesh2 :: PolygonMode -> (GLint, GLint) -> (GLint, GLint) -> IO () Source #

### Evaluating a Single Point on a Mesh

evalPoint1 :: GLint -> IO () Source #

evalPoint2 :: (GLint, GLint) -> IO () Source #

# Normal Generation

autoNormal :: StateVar Capability Source #