OpenGL-2.3.0.0: A binding for the OpenGL graphics systemSource codeContentsIndex
Graphics.Rendering.OpenGL.GL.VertexSpec
Portabilityportable
Stabilitystable
Maintainersven.panne@aedion.de
Contents
Vertex Coordinates
Auxiliary Vertex Attributes
Texture Coordinates
Normal
Fog Coordinate
Color and Secondary Color
Generic Vertex Attributes
Texture Units
Description
This module corresponds to section 2.7 (Vertex Specification) of the OpenGL 2.1 specs.
Synopsis
class Vertex a where
vertex :: a -> IO ()
vertexv :: Ptr a -> IO ()
class VertexComponent a
currentTextureCoords :: StateVar (TexCoord4 GLfloat)
class TexCoord a where
texCoord :: a -> IO ()
texCoordv :: Ptr a -> IO ()
multiTexCoord :: TextureUnit -> a -> IO ()
multiTexCoordv :: TextureUnit -> Ptr a -> IO ()
class TexCoordComponent a
newtype TexCoord1 a = TexCoord1 a
data TexCoord2 a = TexCoord2 !a !a
data TexCoord3 a = TexCoord3 !a !a !a
data TexCoord4 a = TexCoord4 !a !a !a !a
currentNormal :: StateVar (Normal3 GLfloat)
class Normal a where
normal :: a -> IO ()
normalv :: Ptr a -> IO ()
class NormalComponent a
data Normal3 a = Normal3 !a !a !a
currentFogCoord :: StateVar (FogCoord1 GLfloat)
class FogCoord a where
fogCoord :: a -> IO ()
fogCoordv :: Ptr a -> IO ()
class FogCoordComponent a
newtype FogCoord1 a = FogCoord1 a
rgbaMode :: GettableStateVar Bool
currentColor :: StateVar (Color4 GLfloat)
class Color a where
color :: a -> IO ()
colorv :: Ptr a -> IO ()
currentSecondaryColor :: StateVar (Color3 GLfloat)
class SecondaryColor a where
secondaryColor :: a -> IO ()
secondaryColorv :: Ptr a -> IO ()
class ColorComponent a
data Color3 a = Color3 !a !a !a
data Color4 a = Color4 !a !a !a !a
currentIndex :: StateVar (Index1 GLint)
class Index a where
index :: a -> IO ()
indexv :: Ptr a -> IO ()
class IndexComponent a
newtype Index1 a = Index1 a
data IntegerHandling
= ToFloat
| ToNormalizedFloat
| KeepIntegral
newtype AttribLocation = AttribLocation GLuint
currentVertexAttrib :: AttribLocation -> StateVar (Vertex4 GLfloat)
currentVertexAttribI :: AttribLocation -> StateVar (Vertex4 GLint)
currentVertexAttribIu :: AttribLocation -> StateVar (Vertex4 GLuint)
class VertexAttrib a where
vertexAttrib :: IntegerHandling -> AttribLocation -> a -> IO ()
vertexAttribv :: IntegerHandling -> AttribLocation -> Ptr a -> IO ()
class (Storable a, Num a) => VertexAttribComponent a where
vertexAttrib1 :: AttribLocation -> a -> IO ()
vertexAttrib2 :: AttribLocation -> a -> a -> IO ()
vertexAttrib3 :: AttribLocation -> a -> a -> a -> IO ()
vertexAttrib4 :: AttribLocation -> a -> a -> a -> a -> IO ()
vertexAttrib1N :: AttribLocation -> a -> IO ()
vertexAttrib2N :: AttribLocation -> a -> a -> IO ()
vertexAttrib3N :: AttribLocation -> a -> a -> a -> IO ()
vertexAttrib4N :: AttribLocation -> a -> a -> a -> a -> IO ()
vertexAttrib1I :: AttribLocation -> a -> IO ()
vertexAttrib2I :: AttribLocation -> a -> a -> IO ()
vertexAttrib3I :: AttribLocation -> a -> a -> a -> IO ()
vertexAttrib4I :: AttribLocation -> a -> a -> a -> a -> IO ()
vertexAttrib1v :: AttribLocation -> Ptr a -> IO ()
vertexAttrib2v :: AttribLocation -> Ptr a -> IO ()
vertexAttrib3v :: AttribLocation -> Ptr a -> IO ()
vertexAttrib4v :: AttribLocation -> Ptr a -> IO ()
vertexAttrib1Nv :: AttribLocation -> Ptr a -> IO ()
vertexAttrib2Nv :: AttribLocation -> Ptr a -> IO ()
vertexAttrib3Nv :: AttribLocation -> Ptr a -> IO ()
vertexAttrib4Nv :: AttribLocation -> Ptr a -> IO ()
vertexAttrib1Iv :: AttribLocation -> Ptr a -> IO ()
vertexAttrib2Iv :: AttribLocation -> Ptr a -> IO ()
vertexAttrib3Iv :: AttribLocation -> Ptr a -> IO ()
vertexAttrib4Iv :: AttribLocation -> Ptr a -> IO ()
newtype TextureUnit = TextureUnit GLuint
maxTextureUnit :: GettableStateVar TextureUnit
Vertex Coordinates
class Vertex a whereSource

Specify the (x, y, z, w) coordinates of a four-dimensional vertex. This must only be done during Graphics.Rendering.OpenGL.GL.BeginEnd.renderPrimitive, otherwise the behaviour is unspecified. The current values of the auxiliary vertex attributes are associated with the vertex.

Note that there is no such thing as a "current vertex" which could be retrieved.

Methods
vertex :: a -> IO ()Source
vertexv :: Ptr a -> IO ()Source
show/hide Instances
class VertexComponent a Source
The class of all types which can be used as a vertex coordinate.
show/hide Instances
Auxiliary Vertex Attributes

Apart from its coordinates in four-dimensional space, every vertex has associated auxiliary attributes: Its texture coordinates, a normal, a fog coordinate, and a color plus a secondary color. For every attribute, the OpenGL state contains its current value, which can be changed at any time.

Every attribute has a "natural" format via which it can be manipulated directly as part of the OpenGL state, e.g. the current texture coordinates are internally handled as TexCoord4 GLfloat. Different formats are converted to this format, e.g. the s, r, and t coordinates of a TexCoord3 GLint are converted to floating point values and a q coordinate of 1.0 is implicitly assumed.

Consequently, the vast majority of classes, functions, and data types in this module are for convenience only and offer no additional functionality.

Texture Coordinates
currentTextureCoords :: StateVar (TexCoord4 GLfloat)Source
The current texture coordinates (s, t, r, q) for the current texture unit (see Graphics.Rendering.OpenGL.GL.CoordTrans.activeTexture). The initial value is (0,0,0,1) for all texture units.
class TexCoord a whereSource
Change the current texture coordinates of the current or given texture unit.
Methods
texCoord :: a -> IO ()Source
texCoordv :: Ptr a -> IO ()Source
multiTexCoord :: TextureUnit -> a -> IO ()Source
multiTexCoordv :: TextureUnit -> Ptr a -> IO ()Source
show/hide Instances
class TexCoordComponent a Source
The class of all types which can be used as a texture coordinate.
show/hide Instances
newtype TexCoord1 a Source
Texture coordinates with t=0, r=0, and q=1.
Constructors
TexCoord1 a
show/hide Instances
data TexCoord2 a Source
Texture coordinates with r=0 and q=1.
Constructors
TexCoord2 !a !a
show/hide Instances
data TexCoord3 a Source
Texture coordinates with q=1.
Constructors
TexCoord3 !a !a !a
show/hide Instances
data TexCoord4 a Source
Fully-fledged four-dimensional texture coordinates.
Constructors
TexCoord4 !a !a !a !a
show/hide Instances
Normal
currentNormal :: StateVar (Normal3 GLfloat)Source
The current normal (x, y, z). The initial value is the unit vector (0, 0, 1).
class Normal a whereSource

Change the current normal. Integral arguments are converted to floating-point with a linear mapping that maps the most positive representable integer value to 1.0, and the most negative representable integer value to -1.0.

Normals specified with normal or normalv need not have unit length. If Graphics.Rendering.OpenGL.GL.CoordTrans.normalize is enabled, then normals of any length specified with normal or normalv are normalized after transformation. If Graphics.Rendering.OpenGL.GL.CoordTrans.rescaleNormal is enabled, normals are scaled by a scaling factor derived from the modelview matrix. Graphics.Rendering.OpenGL.GL.CoordTrans.rescaleNormal requires that the originally specified normals were of unit length, and that the modelview matrix contains only uniform scales for proper results. Normalization is initially disabled.

Methods
normal :: a -> IO ()Source
normalv :: Ptr a -> IO ()Source
show/hide Instances
class NormalComponent a Source
The class of all types which can be used as a component of a normal.
show/hide Instances
data Normal3 a Source
Constructors
Normal3 !a !a !a
show/hide Instances
Fog Coordinate
currentFogCoord :: StateVar (FogCoord1 GLfloat)Source
The current fog coordinate. The initial value is 0.
class FogCoord a whereSource
Change the current fog coordinate.
Methods
fogCoord :: a -> IO ()Source
fogCoordv :: Ptr a -> IO ()Source
show/hide Instances
class FogCoordComponent a Source
The class of all types which can be used as the fog coordinate.
show/hide Instances
newtype FogCoord1 a Source
A fog coordinate.
Constructors
FogCoord1 a
show/hide Instances
Color and Secondary Color
rgbaMode :: GettableStateVar BoolSource
If rgbaMode contains True, the color buffers store RGBA value. If color indexes are stored, it contains False.
currentColor :: StateVar (Color4 GLfloat)Source
class Color a whereSource
Change the current color.
Methods
color :: a -> IO ()Source
colorv :: Ptr a -> IO ()Source
show/hide Instances
currentSecondaryColor :: StateVar (Color3 GLfloat)Source
class SecondaryColor a whereSource
Change the current secondary color.
Methods
secondaryColor :: a -> IO ()Source
secondaryColorv :: Ptr a -> IO ()Source
show/hide Instances
class ColorComponent a Source
The class of all types which can be used as a color component.
show/hide Instances
data Color3 a Source
Constructors
Color3 !a !a !a
show/hide Instances
data Color4 a Source
A fully-fledged RGBA color.
Constructors
Color4 !a !a !a !a
show/hide Instances
currentIndex :: StateVar (Index1 GLint)Source
class Index a whereSource
Change the current color index.
Methods
index :: a -> IO ()Source
indexv :: Ptr a -> IO ()Source
show/hide Instances
class IndexComponent a Source
The class of all types which can be used as a color index.
show/hide Instances
newtype Index1 a Source
A color index.
Constructors
Index1 a
show/hide Instances
Generic Vertex Attributes
data IntegerHandling Source
Constructors
ToFloat
ToNormalizedFloat
KeepIntegral
show/hide Instances
newtype AttribLocation Source
Constructors
AttribLocation GLuint
show/hide Instances
currentVertexAttrib :: AttribLocation -> StateVar (Vertex4 GLfloat)Source
currentVertexAttribI :: AttribLocation -> StateVar (Vertex4 GLint)Source
currentVertexAttribIu :: AttribLocation -> StateVar (Vertex4 GLuint)Source
class VertexAttrib a whereSource
Methods
vertexAttrib :: IntegerHandling -> AttribLocation -> a -> IO ()Source
vertexAttribv :: IntegerHandling -> AttribLocation -> Ptr a -> IO ()Source
show/hide Instances
class (Storable a, Num a) => VertexAttribComponent a whereSource
The class of all types which can be used as a generic vertex attribute. NOTE: Do not use the methods of this class directly, they were only exported by accident and will be hidden in future versions of this package.
Methods
vertexAttrib1 :: AttribLocation -> a -> IO ()Source
vertexAttrib2 :: AttribLocation -> a -> a -> IO ()Source
vertexAttrib3 :: AttribLocation -> a -> a -> a -> IO ()Source
vertexAttrib4 :: AttribLocation -> a -> a -> a -> a -> IO ()Source
vertexAttrib1N :: AttribLocation -> a -> IO ()Source
vertexAttrib2N :: AttribLocation -> a -> a -> IO ()Source
vertexAttrib3N :: AttribLocation -> a -> a -> a -> IO ()Source
vertexAttrib4N :: AttribLocation -> a -> a -> a -> a -> IO ()Source
vertexAttrib1I :: AttribLocation -> a -> IO ()Source
vertexAttrib2I :: AttribLocation -> a -> a -> IO ()Source
vertexAttrib3I :: AttribLocation -> a -> a -> a -> IO ()Source
vertexAttrib4I :: AttribLocation -> a -> a -> a -> a -> IO ()Source
vertexAttrib1v :: AttribLocation -> Ptr a -> IO ()Source
vertexAttrib2v :: AttribLocation -> Ptr a -> IO ()Source
vertexAttrib3v :: AttribLocation -> Ptr a -> IO ()Source
vertexAttrib4v :: AttribLocation -> Ptr a -> IO ()Source
vertexAttrib1Nv :: AttribLocation -> Ptr a -> IO ()Source
vertexAttrib2Nv :: AttribLocation -> Ptr a -> IO ()Source
vertexAttrib3Nv :: AttribLocation -> Ptr a -> IO ()Source
vertexAttrib4Nv :: AttribLocation -> Ptr a -> IO ()Source
vertexAttrib1Iv :: AttribLocation -> Ptr a -> IO ()Source
vertexAttrib2Iv :: AttribLocation -> Ptr a -> IO ()Source
vertexAttrib3Iv :: AttribLocation -> Ptr a -> IO ()Source
vertexAttrib4Iv :: AttribLocation -> Ptr a -> IO ()Source
show/hide Instances
Texture Units
newtype TextureUnit Source
Identifies a texture unit via its number, which must be in the range of (0 .. maxTextureUnit).
Constructors
TextureUnit GLuint
show/hide Instances
maxTextureUnit :: GettableStateVar TextureUnitSource
An implementation must support at least 2 texture units, but it may support up to 32 ones. This state variable can be used to query the actual implementation limit.
Produced by Haddock version 2.4.2