Copyright | (c) Sven Panne 2002-2016 |
---|---|
License | BSD3 |
Maintainer | Sven Panne <svenpanne@gmail.com> |
Stability | stable |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Graphics.Rendering.OpenGL.GL.VertexSpec
Contents
Description
This module corresponds to section 2.7 (Vertex Specification) of the OpenGL 2.1 specs.
- class Vertex a where
- class VertexComponent a
- currentTextureCoords :: StateVar (TexCoord4 GLfloat)
- class TexCoord a where
- 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
- class NormalComponent a
- data Normal3 a = Normal3 !a !a !a
- currentFogCoord :: StateVar (FogCoord1 GLfloat)
- class FogCoord a where
- class FogCoordComponent a
- newtype FogCoord1 a = FogCoord1 a
- rgbaMode :: GettableStateVar Bool
- currentColor :: StateVar (Color4 GLfloat)
- class Color a where
- currentSecondaryColor :: StateVar (Color3 GLfloat)
- class SecondaryColor a where
- 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
- class IndexComponent a
- newtype Index1 a = Index1 a
- data IntegerHandling
- newtype AttribLocation = AttribLocation GLuint
- currentVertexAttrib :: AttribLocation -> StateVar (Vertex4 GLfloat)
- currentVertexAttribI :: AttribLocation -> StateVar (Vertex4 GLint)
- currentVertexAttribIu :: AttribLocation -> StateVar (Vertex4 GLuint)
- class VertexAttrib a where
- class (Storable a, Num a) => VertexAttribComponent a where
- newtype TextureUnit = TextureUnit GLuint
- maxTextureUnit :: GettableStateVar TextureUnit
Vertex Coordinates
Specify the (x, y, z, w) coordinates of a four-dimensional vertex.
This must only be done during
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.
Instances
VertexComponent a => Vertex (Vertex4 a) Source # | |
VertexComponent a => Vertex (Vertex3 a) Source # | |
VertexComponent a => Vertex (Vertex2 a) Source # | |
class VertexComponent a Source #
The class of all types which can be used as a vertex coordinate.
Minimal complete definition
vertex2, vertex3, vertex4, vertex2v, vertex3v, vertex4v
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
. Different formats are
converted to this format, e.g. the s, r, and t coordinates of a
TexCoord4
GLfloat
are converted to floating point values and a q
coordinate of 1.0 is implicitly assumed.TexCoord3
GLint
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 activeTexture
).
The initial value is (0,0,0,1) for all texture units.
class TexCoord a where Source #
Change the current texture coordinates of the current or given texture unit.
Minimal complete definition
Methods
texCoord :: a -> IO () Source #
texCoordv :: Ptr a -> IO () Source #
multiTexCoord :: TextureUnit -> a -> IO () Source #
multiTexCoordv :: TextureUnit -> Ptr a -> IO () Source #
Instances
TexCoordComponent a => TexCoord (TexCoord4 a) Source # | |
TexCoordComponent a => TexCoord (TexCoord3 a) Source # | |
TexCoordComponent a => TexCoord (TexCoord2 a) Source # | |
TexCoordComponent a => TexCoord (TexCoord1 a) Source # | |
class TexCoordComponent a Source #
The class of all types which can be used as a texture coordinate.
Minimal complete definition
texCoord1, texCoord2, texCoord3, texCoord4, texCoord1v, texCoord2v, texCoord3v, texCoord4v, multiTexCoord1, multiTexCoord2, multiTexCoord3, multiTexCoord4, multiTexCoord1v, multiTexCoord2v, multiTexCoord3v, multiTexCoord4v
Texture coordinates with t=0, r=0, and q=1.
Constructors
TexCoord1 a |
Instances
Functor TexCoord1 Source # | |
Applicative TexCoord1 Source # | |
Foldable TexCoord1 Source # | |
Traversable TexCoord1 Source # | |
ControlPoint TexCoord1 Source # | |
Bounded a => Bounded (TexCoord1 a) Source # | |
Eq a => Eq (TexCoord1 a) Source # | |
Ord a => Ord (TexCoord1 a) Source # | |
Read a => Read (TexCoord1 a) Source # | |
Show a => Show (TexCoord1 a) Source # | |
Ix a => Ix (TexCoord1 a) Source # | |
Storable a => Storable (TexCoord1 a) Source # | |
VertexAttribComponent a => VertexAttrib (TexCoord1 a) Source # | |
TexCoordComponent a => TexCoord (TexCoord1 a) Source # | |
UniformComponent a => Uniform (TexCoord1 a) Source # | |
Texture coordinates with r=0 and q=1.
Constructors
TexCoord2 !a !a |
Instances
Functor TexCoord2 Source # | |
Applicative TexCoord2 Source # | |
Foldable TexCoord2 Source # | |
Traversable TexCoord2 Source # | |
ControlPoint TexCoord2 Source # | |
Bounded a => Bounded (TexCoord2 a) Source # | |
Eq a => Eq (TexCoord2 a) Source # | |
Ord a => Ord (TexCoord2 a) Source # | |
Read a => Read (TexCoord2 a) Source # | |
Show a => Show (TexCoord2 a) Source # | |
Ix a => Ix (TexCoord2 a) Source # | |
Storable a => Storable (TexCoord2 a) Source # | |
VertexAttribComponent a => VertexAttrib (TexCoord2 a) Source # | |
TexCoordComponent a => TexCoord (TexCoord2 a) Source # | |
UniformComponent a => Uniform (TexCoord2 a) Source # | |
Texture coordinates with q=1.
Constructors
TexCoord3 !a !a !a |
Instances
Functor TexCoord3 Source # | |
Applicative TexCoord3 Source # | |
Foldable TexCoord3 Source # | |
Traversable TexCoord3 Source # | |
ControlPoint TexCoord3 Source # | |
Bounded a => Bounded (TexCoord3 a) Source # | |
Eq a => Eq (TexCoord3 a) Source # | |
Ord a => Ord (TexCoord3 a) Source # | |
Read a => Read (TexCoord3 a) Source # | |
Show a => Show (TexCoord3 a) Source # | |
Ix a => Ix (TexCoord3 a) Source # | |
Storable a => Storable (TexCoord3 a) Source # | |
VertexAttribComponent a => VertexAttrib (TexCoord3 a) Source # | |
TexCoordComponent a => TexCoord (TexCoord3 a) Source # | |
UniformComponent a => Uniform (TexCoord3 a) Source # | |
Fully-fledged four-dimensional texture coordinates.
Constructors
TexCoord4 !a !a !a !a |
Instances
Functor TexCoord4 Source # | |
Applicative TexCoord4 Source # | |
Foldable TexCoord4 Source # | |
Traversable TexCoord4 Source # | |
ControlPoint TexCoord4 Source # | |
Bounded a => Bounded (TexCoord4 a) Source # | |
Eq a => Eq (TexCoord4 a) Source # | |
Ord a => Ord (TexCoord4 a) Source # | |
Read a => Read (TexCoord4 a) Source # | |
Show a => Show (TexCoord4 a) Source # | |
Ix a => Ix (TexCoord4 a) Source # | |
Storable a => Storable (TexCoord4 a) Source # | |
VertexAttribComponent a => VertexAttrib (TexCoord4 a) Source # | |
TexCoordComponent a => TexCoord (TexCoord4 a) Source # | |
UniformComponent a => Uniform (TexCoord4 a) Source # | |
Normal
currentNormal :: StateVar (Normal3 GLfloat) Source #
The current normal (x, y, z). The initial value is the unit vector (0, 0, 1).
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 normalize
is enabled, then
normals of any length specified with normal
or normalv
are normalized
after transformation. If
rescaleNormal
is enabled, normals
are scaled by a scaling factor derived from the modelview matrix.
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.
Instances
NormalComponent a => Normal (Normal3 a) Source # | |
class NormalComponent a Source #
The class of all types which can be used as a component of a normal.
Minimal complete definition
normal3, normal3v
Constructors
Normal3 !a !a !a |
Instances
Functor Normal3 Source # | |
Applicative Normal3 Source # | |
Foldable Normal3 Source # | |
Traversable Normal3 Source # | |
ControlPoint Normal3 Source # | |
Bounded a => Bounded (Normal3 a) Source # | |
Eq a => Eq (Normal3 a) Source # | |
Ord a => Ord (Normal3 a) Source # | |
Read a => Read (Normal3 a) Source # | |
Show a => Show (Normal3 a) Source # | |
Ix a => Ix (Normal3 a) Source # | |
Storable a => Storable (Normal3 a) Source # | |
VertexAttribComponent a => VertexAttrib (Normal3 a) Source # | |
NormalComponent a => Normal (Normal3 a) Source # | |
UniformComponent a => Uniform (Normal3 a) Source # | |
Fog Coordinate
currentFogCoord :: StateVar (FogCoord1 GLfloat) Source #
The current fog coordinate. The initial value is 0.
class FogCoord a where Source #
Change the current fog coordinate.
Instances
FogCoordComponent a => FogCoord (FogCoord1 a) Source # | |
class FogCoordComponent a Source #
The class of all types which can be used as the fog coordinate.
Minimal complete definition
fogCoord1, fogCoord1v
Instances
A fog coordinate.
Constructors
FogCoord1 a |
Instances
Functor FogCoord1 Source # | |
Applicative FogCoord1 Source # | |
Foldable FogCoord1 Source # | |
Traversable FogCoord1 Source # | |
Bounded a => Bounded (FogCoord1 a) Source # | |
Eq a => Eq (FogCoord1 a) Source # | |
Ord a => Ord (FogCoord1 a) Source # | |
Read a => Read (FogCoord1 a) Source # | |
Show a => Show (FogCoord1 a) Source # | |
Ix a => Ix (FogCoord1 a) Source # | |
Storable a => Storable (FogCoord1 a) Source # | |
VertexAttribComponent a => VertexAttrib (FogCoord1 a) Source # | |
FogCoordComponent a => FogCoord (FogCoord1 a) Source # | |
UniformComponent a => Uniform (FogCoord1 a) Source # | |
Color and Secondary Color
Change the current color.
Instances
ColorComponent a => Color (Color4 a) Source # | |
ColorComponent a => Color (Color3 a) Source # | |
class SecondaryColor a where Source #
Change the current secondary color.
Minimal complete definition
Instances
ColorComponent a => SecondaryColor (Color3 a) Source # | |
class ColorComponent a Source #
The class of all types which can be used as a color component.
Minimal complete definition
color3, color4, color3v, color4v, secondaryColor3, secondaryColor3v
Constructors
Color3 !a !a !a |
Instances
Functor Color3 Source # | |
Applicative Color3 Source # | |
Foldable Color3 Source # | |
Traversable Color3 Source # | |
Bounded a => Bounded (Color3 a) Source # | |
Eq a => Eq (Color3 a) Source # | |
Ord a => Ord (Color3 a) Source # | |
Read a => Read (Color3 a) Source # | |
Show a => Show (Color3 a) Source # | |
Ix a => Ix (Color3 a) Source # | |
Storable a => Storable (Color3 a) Source # | |
VertexAttribComponent a => VertexAttrib (Color3 a) Source # | |
ColorComponent a => SecondaryColor (Color3 a) Source # | |
ColorComponent a => Color (Color3 a) Source # | |
UniformComponent a => Uniform (Color3 a) Source # | |
A fully-fledged RGBA color.
Constructors
Color4 !a !a !a !a |
Instances
Functor Color4 Source # | |
Applicative Color4 Source # | |
Foldable Color4 Source # | |
Traversable Color4 Source # | |
ControlPoint Color4 Source # | |
Bounded a => Bounded (Color4 a) Source # | |
Eq a => Eq (Color4 a) Source # | |
Ord a => Ord (Color4 a) Source # | |
Read a => Read (Color4 a) Source # | |
Show a => Show (Color4 a) Source # | |
Ix a => Ix (Color4 a) Source # | |
Storable a => Storable (Color4 a) Source # | |
VertexAttribComponent a => VertexAttrib (Color4 a) Source # | |
ColorComponent a => Color (Color4 a) Source # | |
UniformComponent a => Uniform (Color4 a) Source # | |
Change the current color index.
Instances
IndexComponent a => Index (Index1 a) Source # | |
class IndexComponent a Source #
The class of all types which can be used as a color index.
Minimal complete definition
index1, index1v
A color index.
Constructors
Index1 a |
Instances
Functor Index1 Source # | |
Applicative Index1 Source # | |
Foldable Index1 Source # | |
Traversable Index1 Source # | |
ControlPoint Index1 Source # | |
Bounded a => Bounded (Index1 a) Source # | |
Eq a => Eq (Index1 a) Source # | |
Ord a => Ord (Index1 a) Source # | |
Read a => Read (Index1 a) Source # | |
Show a => Show (Index1 a) Source # | |
Ix a => Ix (Index1 a) Source # | |
Storable a => Storable (Index1 a) Source # | |
VertexAttribComponent a => VertexAttrib (Index1 a) Source # | |
IndexComponent a => Index (Index1 a) Source # | |
UniformComponent a => Uniform (Index1 a) Source # | |
Generic Vertex Attributes
class VertexAttrib a where Source #
Minimal complete definition
Methods
vertexAttrib :: IntegerHandling -> AttribLocation -> a -> IO () Source #
vertexAttribv :: IntegerHandling -> AttribLocation -> Ptr a -> IO () Source #
Instances
class (Storable a, Num a) => VertexAttribComponent a where Source #
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.
Minimal complete definition
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 #
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 |
Instances
maxTextureUnit :: GettableStateVar TextureUnit Source #
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.