--------------------------------------------------------------------------------
-- |
-- Module      :  Graphics.Rendering.OpenGL.GL.VertexSpec
-- Copyright   :  (c) Sven Panne 2002-2019
-- License     :  BSD3
-- 
-- Maintainer  :  Sven Panne <svenpanne@gmail.com>
-- Stability   :  stable
-- Portability :  portable
--
-- This module corresponds to section 2.7 (Vertex Specification) of the
-- OpenGL 2.1 specs.
--
--------------------------------------------------------------------------------

{-# LANGUAGE TypeSynonymInstances #-}

module Graphics.Rendering.OpenGL.GL.VertexSpec (
   -- * Vertex Coordinates
   Vertex(..),
   VertexComponent,

   -- * Auxiliary Vertex Attributes
   -- $AuxiliaryVertexAttributes

   -- ** Texture Coordinates
   currentTextureCoords, TexCoord(..),
   TexCoordComponent,
   TexCoord1(..), TexCoord2(..), TexCoord3(..), TexCoord4(..),

   -- ** Normal
   currentNormal, Normal(..),
   NormalComponent,
   Normal3(..),

   -- ** Fog Coordinate
   currentFogCoord, FogCoord(..),
   FogCoordComponent,
   FogCoord1(..),

   -- ** Color and Secondary Color
   rgbaMode,
   currentColor, Color(..),
   currentSecondaryColor, SecondaryColor(..),
   ColorComponent,
   Color3(..), Color4(..),

   currentIndex, Index(..),
   IndexComponent,
   Index1(..),

   -- * Generic Vertex Attributes
   IntegerHandling(..), AttribLocation(..),
   currentVertexAttrib, currentVertexAttribI, currentVertexAttribIu,
   VertexAttrib(..), VertexAttribComponent(..),

   -- * Texture Units
   TextureUnit(..), maxTextureUnit
) where

import Data.StateVar
import Foreign.Marshal.Array
import Foreign.Ptr
import Foreign.Storable
import Graphics.Rendering.OpenGL.GL.GLboolean
import Graphics.Rendering.OpenGL.GL.PeekPoke
import Graphics.Rendering.OpenGL.GL.QueryUtils
import Graphics.Rendering.OpenGL.GL.Tensor
import Graphics.Rendering.OpenGL.GL.Texturing.TextureUnit
import Graphics.Rendering.OpenGL.GL.VertexAttributes
import Graphics.GL

--------------------------------------------------------------------------------

-- | The class of all types which can be used as a vertex coordinate.

class VertexComponent a where
   vertex2 :: a -> a -> IO ()
   vertex3 :: a -> a -> a -> IO ()
   vertex4 :: a -> a -> a -> a -> IO ()

   vertex2v :: Ptr a -> IO ()
   vertex3v :: Ptr a -> IO ()
   vertex4v :: Ptr a -> IO ()

instance VertexComponent GLshort where
   vertex2 :: GLshort -> GLshort -> IO ()
vertex2 = GLshort -> GLshort -> IO ()
forall (m :: * -> *). MonadIO m => GLshort -> GLshort -> m ()
glVertex2s
   vertex3 :: GLshort -> GLshort -> GLshort -> IO ()
vertex3 = GLshort -> GLshort -> GLshort -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLshort -> GLshort -> GLshort -> m ()
glVertex3s
   vertex4 :: GLshort -> GLshort -> GLshort -> GLshort -> IO ()
vertex4 = GLshort -> GLshort -> GLshort -> GLshort -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLshort -> GLshort -> GLshort -> GLshort -> m ()
glVertex4s

   vertex2v :: Ptr GLshort -> IO ()
vertex2v = Ptr GLshort -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLshort -> m ()
glVertex2sv
   vertex3v :: Ptr GLshort -> IO ()
vertex3v = Ptr GLshort -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLshort -> m ()
glVertex3sv
   vertex4v :: Ptr GLshort -> IO ()
vertex4v = Ptr GLshort -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLshort -> m ()
glVertex4sv

instance VertexComponent GLint where
   vertex2 :: GLint -> GLint -> IO ()
vertex2 = GLint -> GLint -> IO ()
forall (m :: * -> *). MonadIO m => GLint -> GLint -> m ()
glVertex2i
   vertex3 :: GLint -> GLint -> GLint -> IO ()
vertex3 = GLint -> GLint -> GLint -> IO ()
forall (m :: * -> *). MonadIO m => GLint -> GLint -> GLint -> m ()
glVertex3i
   vertex4 :: GLint -> GLint -> GLint -> GLint -> IO ()
vertex4 = GLint -> GLint -> GLint -> GLint -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLint -> GLint -> GLint -> GLint -> m ()
glVertex4i

   vertex2v :: Ptr GLint -> IO ()
vertex2v = Ptr GLint -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLint -> m ()
glVertex2iv
   vertex3v :: Ptr GLint -> IO ()
vertex3v = Ptr GLint -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLint -> m ()
glVertex3iv
   vertex4v :: Ptr GLint -> IO ()
vertex4v = Ptr GLint -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLint -> m ()
glVertex4iv

instance VertexComponent GLfloat where
   vertex2 :: GLfloat -> GLfloat -> IO ()
vertex2 = GLfloat -> GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => GLfloat -> GLfloat -> m ()
glVertex2f
   vertex3 :: GLfloat -> GLfloat -> GLfloat -> IO ()
vertex3 = GLfloat -> GLfloat -> GLfloat -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLfloat -> GLfloat -> GLfloat -> m ()
glVertex3f
   vertex4 :: GLfloat -> GLfloat -> GLfloat -> GLfloat -> IO ()
vertex4 = GLfloat -> GLfloat -> GLfloat -> GLfloat -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLfloat -> GLfloat -> GLfloat -> GLfloat -> m ()
glVertex4f

   vertex2v :: Ptr GLfloat -> IO ()
vertex2v = Ptr GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLfloat -> m ()
glVertex2fv
   vertex3v :: Ptr GLfloat -> IO ()
vertex3v = Ptr GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLfloat -> m ()
glVertex3fv
   vertex4v :: Ptr GLfloat -> IO ()
vertex4v = Ptr GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLfloat -> m ()
glVertex4fv

instance VertexComponent GLdouble where
   vertex2 :: GLdouble -> GLdouble -> IO ()
vertex2 = GLdouble -> GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => GLdouble -> GLdouble -> m ()
glVertex2d
   vertex3 :: GLdouble -> GLdouble -> GLdouble -> IO ()
vertex3 = GLdouble -> GLdouble -> GLdouble -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLdouble -> GLdouble -> GLdouble -> m ()
glVertex3d
   vertex4 :: GLdouble -> GLdouble -> GLdouble -> GLdouble -> IO ()
vertex4 = GLdouble -> GLdouble -> GLdouble -> GLdouble -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLdouble -> GLdouble -> GLdouble -> GLdouble -> m ()
glVertex4d

   vertex2v :: Ptr GLdouble -> IO ()
vertex2v = Ptr GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLdouble -> m ()
glVertex2dv
   vertex3v :: Ptr GLdouble -> IO ()
vertex3v = Ptr GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLdouble -> m ()
glVertex3dv
   vertex4v :: Ptr GLdouble -> IO ()
vertex4v = Ptr GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLdouble -> m ()
glVertex4dv

--------------------------------------------------------------------------------

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

class Vertex a where
   vertex  ::     a -> IO ()
   vertexv :: Ptr a -> IO ()

instance VertexComponent a => Vertex (Vertex2 a) where
   vertex :: Vertex2 a -> IO ()
vertex (Vertex2 a
x a
y) = a -> a -> IO ()
forall a. VertexComponent a => a -> a -> IO ()
vertex2 a
x a
y
   vertexv :: Ptr (Vertex2 a) -> IO ()
vertexv = Ptr a -> IO ()
forall a. VertexComponent a => Ptr a -> IO ()
vertex2v (Ptr a -> IO ())
-> (Ptr (Vertex2 a) -> Ptr a) -> Ptr (Vertex2 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vertex2 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vertex2 b) -> Ptr b)

instance VertexComponent a => Vertex (Vertex3 a) where
   vertex :: Vertex3 a -> IO ()
vertex (Vertex3 a
x a
y a
z) = a -> a -> a -> IO ()
forall a. VertexComponent a => a -> a -> a -> IO ()
vertex3 a
x a
y a
z
   vertexv :: Ptr (Vertex3 a) -> IO ()
vertexv = Ptr a -> IO ()
forall a. VertexComponent a => Ptr a -> IO ()
vertex3v (Ptr a -> IO ())
-> (Ptr (Vertex3 a) -> Ptr a) -> Ptr (Vertex3 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vertex3 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vertex3 b) -> Ptr b)

instance VertexComponent a => Vertex (Vertex4 a) where
   vertex :: Vertex4 a -> IO ()
vertex (Vertex4 a
x a
y a
z a
w) = a -> a -> a -> a -> IO ()
forall a. VertexComponent a => a -> a -> a -> a -> IO ()
vertex4 a
x a
y a
z a
w
   vertexv :: Ptr (Vertex4 a) -> IO ()
vertexv = Ptr a -> IO ()
forall a. VertexComponent a => Ptr a -> IO ()
vertex4v (Ptr a -> IO ())
-> (Ptr (Vertex4 a) -> Ptr a) -> Ptr (Vertex4 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vertex4 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vertex4 b) -> Ptr b)

--------------------------------------------------------------------------------
-- $AuxiliaryVertexAttributes
-- 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.

--------------------------------------------------------------------------------

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

currentTextureCoords :: StateVar (TexCoord4 GLfloat)
currentTextureCoords :: StateVar (TexCoord4 GLfloat)
currentTextureCoords =
   IO (TexCoord4 GLfloat)
-> (TexCoord4 GLfloat -> IO ()) -> StateVar (TexCoord4 GLfloat)
forall a. IO a -> (a -> IO ()) -> StateVar a
makeStateVar ((GLfloat -> GLfloat -> GLfloat -> GLfloat -> TexCoord4 GLfloat)
-> PName4F -> IO (TexCoord4 GLfloat)
forall p a.
GetPName4F p =>
(GLfloat -> GLfloat -> GLfloat -> GLfloat -> a) -> p -> IO a
getFloat4 GLfloat -> GLfloat -> GLfloat -> GLfloat -> TexCoord4 GLfloat
forall a. a -> a -> a -> a -> TexCoord4 a
TexCoord4 PName4F
GetCurrentTextureCoords) TexCoord4 GLfloat -> IO ()
forall a. TexCoord a => a -> IO ()
texCoord

--------------------------------------------------------------------------------

-- | The class of all types which can be used as a texture coordinate.

class TexCoordComponent a where
   texCoord1 :: a -> IO ()
   texCoord2 :: a -> a -> IO ()
   texCoord3 :: a -> a -> a -> IO ()
   texCoord4 :: a -> a -> a -> a -> IO ()

   texCoord1v :: Ptr a -> IO ()
   texCoord2v :: Ptr a -> IO ()
   texCoord3v :: Ptr a -> IO ()
   texCoord4v :: Ptr a -> IO ()

   multiTexCoord1 :: GLenum -> a -> IO ()
   multiTexCoord2 :: GLenum -> a -> a -> IO ()
   multiTexCoord3 :: GLenum -> a -> a -> a -> IO ()
   multiTexCoord4 :: GLenum -> a -> a -> a -> a -> IO ()

   multiTexCoord1v :: GLenum -> Ptr a -> IO ()
   multiTexCoord2v :: GLenum -> Ptr a -> IO ()
   multiTexCoord3v :: GLenum -> Ptr a -> IO ()
   multiTexCoord4v :: GLenum -> Ptr a -> IO ()

instance TexCoordComponent GLshort where
   texCoord1 :: GLshort -> IO ()
texCoord1 = GLshort -> IO ()
forall (m :: * -> *). MonadIO m => GLshort -> m ()
glTexCoord1s
   texCoord2 :: GLshort -> GLshort -> IO ()
texCoord2 = GLshort -> GLshort -> IO ()
forall (m :: * -> *). MonadIO m => GLshort -> GLshort -> m ()
glTexCoord2s
   texCoord3 :: GLshort -> GLshort -> GLshort -> IO ()
texCoord3 = GLshort -> GLshort -> GLshort -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLshort -> GLshort -> GLshort -> m ()
glTexCoord3s
   texCoord4 :: GLshort -> GLshort -> GLshort -> GLshort -> IO ()
texCoord4 = GLshort -> GLshort -> GLshort -> GLshort -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLshort -> GLshort -> GLshort -> GLshort -> m ()
glTexCoord4s

   texCoord1v :: Ptr GLshort -> IO ()
texCoord1v = Ptr GLshort -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLshort -> m ()
glTexCoord1sv
   texCoord2v :: Ptr GLshort -> IO ()
texCoord2v = Ptr GLshort -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLshort -> m ()
glTexCoord2sv
   texCoord3v :: Ptr GLshort -> IO ()
texCoord3v = Ptr GLshort -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLshort -> m ()
glTexCoord3sv
   texCoord4v :: Ptr GLshort -> IO ()
texCoord4v = Ptr GLshort -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLshort -> m ()
glTexCoord4sv

   multiTexCoord1 :: GLuint -> GLshort -> IO ()
multiTexCoord1 = GLuint -> GLshort -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> GLshort -> m ()
glMultiTexCoord1s
   multiTexCoord2 :: GLuint -> GLshort -> GLshort -> IO ()
multiTexCoord2 = GLuint -> GLshort -> GLshort -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLshort -> GLshort -> m ()
glMultiTexCoord2s
   multiTexCoord3 :: GLuint -> GLshort -> GLshort -> GLshort -> IO ()
multiTexCoord3 = GLuint -> GLshort -> GLshort -> GLshort -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLshort -> GLshort -> GLshort -> m ()
glMultiTexCoord3s
   multiTexCoord4 :: GLuint -> GLshort -> GLshort -> GLshort -> GLshort -> IO ()
multiTexCoord4 = GLuint -> GLshort -> GLshort -> GLshort -> GLshort -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLshort -> GLshort -> GLshort -> GLshort -> m ()
glMultiTexCoord4s

   multiTexCoord1v :: GLuint -> Ptr GLshort -> IO ()
multiTexCoord1v = GLuint -> Ptr GLshort -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLshort -> m ()
glMultiTexCoord1sv
   multiTexCoord2v :: GLuint -> Ptr GLshort -> IO ()
multiTexCoord2v = GLuint -> Ptr GLshort -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLshort -> m ()
glMultiTexCoord2sv
   multiTexCoord3v :: GLuint -> Ptr GLshort -> IO ()
multiTexCoord3v = GLuint -> Ptr GLshort -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLshort -> m ()
glMultiTexCoord3sv
   multiTexCoord4v :: GLuint -> Ptr GLshort -> IO ()
multiTexCoord4v = GLuint -> Ptr GLshort -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLshort -> m ()
glMultiTexCoord4sv

instance TexCoordComponent GLint where
   texCoord1 :: GLint -> IO ()
texCoord1 = GLint -> IO ()
forall (m :: * -> *). MonadIO m => GLint -> m ()
glTexCoord1i
   texCoord2 :: GLint -> GLint -> IO ()
texCoord2 = GLint -> GLint -> IO ()
forall (m :: * -> *). MonadIO m => GLint -> GLint -> m ()
glTexCoord2i
   texCoord3 :: GLint -> GLint -> GLint -> IO ()
texCoord3 = GLint -> GLint -> GLint -> IO ()
forall (m :: * -> *). MonadIO m => GLint -> GLint -> GLint -> m ()
glTexCoord3i
   texCoord4 :: GLint -> GLint -> GLint -> GLint -> IO ()
texCoord4 = GLint -> GLint -> GLint -> GLint -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLint -> GLint -> GLint -> GLint -> m ()
glTexCoord4i

   texCoord1v :: Ptr GLint -> IO ()
texCoord1v = Ptr GLint -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLint -> m ()
glTexCoord1iv
   texCoord2v :: Ptr GLint -> IO ()
texCoord2v = Ptr GLint -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLint -> m ()
glTexCoord2iv
   texCoord3v :: Ptr GLint -> IO ()
texCoord3v = Ptr GLint -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLint -> m ()
glTexCoord3iv
   texCoord4v :: Ptr GLint -> IO ()
texCoord4v = Ptr GLint -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLint -> m ()
glTexCoord4iv

   multiTexCoord1 :: GLuint -> GLint -> IO ()
multiTexCoord1 = GLuint -> GLint -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> GLint -> m ()
glMultiTexCoord1i
   multiTexCoord2 :: GLuint -> GLint -> GLint -> IO ()
multiTexCoord2 = GLuint -> GLint -> GLint -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> GLint -> GLint -> m ()
glMultiTexCoord2i
   multiTexCoord3 :: GLuint -> GLint -> GLint -> GLint -> IO ()
multiTexCoord3 = GLuint -> GLint -> GLint -> GLint -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLint -> GLint -> GLint -> m ()
glMultiTexCoord3i
   multiTexCoord4 :: GLuint -> GLint -> GLint -> GLint -> GLint -> IO ()
multiTexCoord4 = GLuint -> GLint -> GLint -> GLint -> GLint -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLint -> GLint -> GLint -> GLint -> m ()
glMultiTexCoord4i

   multiTexCoord1v :: GLuint -> Ptr GLint -> IO ()
multiTexCoord1v = GLuint -> Ptr GLint -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLint -> m ()
glMultiTexCoord1iv
   multiTexCoord2v :: GLuint -> Ptr GLint -> IO ()
multiTexCoord2v = GLuint -> Ptr GLint -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLint -> m ()
glMultiTexCoord2iv
   multiTexCoord3v :: GLuint -> Ptr GLint -> IO ()
multiTexCoord3v = GLuint -> Ptr GLint -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLint -> m ()
glMultiTexCoord3iv
   multiTexCoord4v :: GLuint -> Ptr GLint -> IO ()
multiTexCoord4v = GLuint -> Ptr GLint -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLint -> m ()
glMultiTexCoord4iv

instance TexCoordComponent GLfloat where
   texCoord1 :: GLfloat -> IO ()
texCoord1 = GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => GLfloat -> m ()
glTexCoord1f
   texCoord2 :: GLfloat -> GLfloat -> IO ()
texCoord2 = GLfloat -> GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => GLfloat -> GLfloat -> m ()
glTexCoord2f
   texCoord3 :: GLfloat -> GLfloat -> GLfloat -> IO ()
texCoord3 = GLfloat -> GLfloat -> GLfloat -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLfloat -> GLfloat -> GLfloat -> m ()
glTexCoord3f
   texCoord4 :: GLfloat -> GLfloat -> GLfloat -> GLfloat -> IO ()
texCoord4 = GLfloat -> GLfloat -> GLfloat -> GLfloat -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLfloat -> GLfloat -> GLfloat -> GLfloat -> m ()
glTexCoord4f

   texCoord1v :: Ptr GLfloat -> IO ()
texCoord1v = Ptr GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLfloat -> m ()
glTexCoord1fv
   texCoord2v :: Ptr GLfloat -> IO ()
texCoord2v = Ptr GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLfloat -> m ()
glTexCoord2fv
   texCoord3v :: Ptr GLfloat -> IO ()
texCoord3v = Ptr GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLfloat -> m ()
glTexCoord3fv
   texCoord4v :: Ptr GLfloat -> IO ()
texCoord4v = Ptr GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLfloat -> m ()
glTexCoord4fv

   multiTexCoord1 :: GLuint -> GLfloat -> IO ()
multiTexCoord1 = GLuint -> GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> GLfloat -> m ()
glMultiTexCoord1f
   multiTexCoord2 :: GLuint -> GLfloat -> GLfloat -> IO ()
multiTexCoord2 = GLuint -> GLfloat -> GLfloat -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLfloat -> GLfloat -> m ()
glMultiTexCoord2f
   multiTexCoord3 :: GLuint -> GLfloat -> GLfloat -> GLfloat -> IO ()
multiTexCoord3 = GLuint -> GLfloat -> GLfloat -> GLfloat -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLfloat -> GLfloat -> GLfloat -> m ()
glMultiTexCoord3f
   multiTexCoord4 :: GLuint -> GLfloat -> GLfloat -> GLfloat -> GLfloat -> IO ()
multiTexCoord4 = GLuint -> GLfloat -> GLfloat -> GLfloat -> GLfloat -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLfloat -> GLfloat -> GLfloat -> GLfloat -> m ()
glMultiTexCoord4f

   multiTexCoord1v :: GLuint -> Ptr GLfloat -> IO ()
multiTexCoord1v = GLuint -> Ptr GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLfloat -> m ()
glMultiTexCoord1fv
   multiTexCoord2v :: GLuint -> Ptr GLfloat -> IO ()
multiTexCoord2v = GLuint -> Ptr GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLfloat -> m ()
glMultiTexCoord2fv
   multiTexCoord3v :: GLuint -> Ptr GLfloat -> IO ()
multiTexCoord3v = GLuint -> Ptr GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLfloat -> m ()
glMultiTexCoord3fv
   multiTexCoord4v :: GLuint -> Ptr GLfloat -> IO ()
multiTexCoord4v = GLuint -> Ptr GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLfloat -> m ()
glMultiTexCoord4fv

instance TexCoordComponent GLdouble where
   texCoord1 :: GLdouble -> IO ()
texCoord1 = GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => GLdouble -> m ()
glTexCoord1d
   texCoord2 :: GLdouble -> GLdouble -> IO ()
texCoord2 = GLdouble -> GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => GLdouble -> GLdouble -> m ()
glTexCoord2d
   texCoord3 :: GLdouble -> GLdouble -> GLdouble -> IO ()
texCoord3 = GLdouble -> GLdouble -> GLdouble -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLdouble -> GLdouble -> GLdouble -> m ()
glTexCoord3d
   texCoord4 :: GLdouble -> GLdouble -> GLdouble -> GLdouble -> IO ()
texCoord4 = GLdouble -> GLdouble -> GLdouble -> GLdouble -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLdouble -> GLdouble -> GLdouble -> GLdouble -> m ()
glTexCoord4d

   texCoord1v :: Ptr GLdouble -> IO ()
texCoord1v = Ptr GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLdouble -> m ()
glTexCoord1dv
   texCoord2v :: Ptr GLdouble -> IO ()
texCoord2v = Ptr GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLdouble -> m ()
glTexCoord2dv
   texCoord3v :: Ptr GLdouble -> IO ()
texCoord3v = Ptr GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLdouble -> m ()
glTexCoord3dv
   texCoord4v :: Ptr GLdouble -> IO ()
texCoord4v = Ptr GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLdouble -> m ()
glTexCoord4dv

   multiTexCoord1 :: GLuint -> GLdouble -> IO ()
multiTexCoord1 = GLuint -> GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> GLdouble -> m ()
glMultiTexCoord1d
   multiTexCoord2 :: GLuint -> GLdouble -> GLdouble -> IO ()
multiTexCoord2 = GLuint -> GLdouble -> GLdouble -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLdouble -> GLdouble -> m ()
glMultiTexCoord2d
   multiTexCoord3 :: GLuint -> GLdouble -> GLdouble -> GLdouble -> IO ()
multiTexCoord3 = GLuint -> GLdouble -> GLdouble -> GLdouble -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLdouble -> GLdouble -> GLdouble -> m ()
glMultiTexCoord3d
   multiTexCoord4 :: GLuint -> GLdouble -> GLdouble -> GLdouble -> GLdouble -> IO ()
multiTexCoord4 = GLuint -> GLdouble -> GLdouble -> GLdouble -> GLdouble -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLdouble -> GLdouble -> GLdouble -> GLdouble -> m ()
glMultiTexCoord4d

   multiTexCoord1v :: GLuint -> Ptr GLdouble -> IO ()
multiTexCoord1v = GLuint -> Ptr GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLdouble -> m ()
glMultiTexCoord1dv
   multiTexCoord2v :: GLuint -> Ptr GLdouble -> IO ()
multiTexCoord2v = GLuint -> Ptr GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLdouble -> m ()
glMultiTexCoord2dv
   multiTexCoord3v :: GLuint -> Ptr GLdouble -> IO ()
multiTexCoord3v = GLuint -> Ptr GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLdouble -> m ()
glMultiTexCoord3dv
   multiTexCoord4v :: GLuint -> Ptr GLdouble -> IO ()
multiTexCoord4v = GLuint -> Ptr GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLdouble -> m ()
glMultiTexCoord4dv

--------------------------------------------------------------------------------

-- | Change the current texture coordinates of the current or given texture
-- unit.

class TexCoord a where
   texCoord       ::                    a -> IO ()
   texCoordv      ::                Ptr a -> IO ()
   multiTexCoord  :: TextureUnit ->     a -> IO ()
   multiTexCoordv :: TextureUnit -> Ptr a -> IO ()

instance TexCoordComponent a => TexCoord (TexCoord1 a) where
   texCoord :: TexCoord1 a -> IO ()
texCoord (TexCoord1 a
s) = a -> IO ()
forall a. TexCoordComponent a => a -> IO ()
texCoord1 a
s
   texCoordv :: Ptr (TexCoord1 a) -> IO ()
texCoordv = Ptr a -> IO ()
forall a. TexCoordComponent a => Ptr a -> IO ()
texCoord1v (Ptr a -> IO ())
-> (Ptr (TexCoord1 a) -> Ptr a) -> Ptr (TexCoord1 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (TexCoord1 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (TexCoord1 b) -> Ptr b)
   multiTexCoord :: TextureUnit -> TexCoord1 a -> IO ()
multiTexCoord TextureUnit
u (TexCoord1 a
s) =
      GLuint -> a -> IO ()
forall a. TexCoordComponent a => GLuint -> a -> IO ()
multiTexCoord1 (TextureUnit -> GLuint
marshalTextureUnit TextureUnit
u) a
s
   multiTexCoordv :: TextureUnit -> Ptr (TexCoord1 a) -> IO ()
multiTexCoordv TextureUnit
u =
      GLuint -> Ptr a -> IO ()
forall a. TexCoordComponent a => GLuint -> Ptr a -> IO ()
multiTexCoord1v (TextureUnit -> GLuint
marshalTextureUnit TextureUnit
u) (Ptr a -> IO ())
-> (Ptr (TexCoord1 a) -> Ptr a) -> Ptr (TexCoord1 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (TexCoord1 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (TexCoord1 b) -> Ptr b)

instance TexCoordComponent a => TexCoord (TexCoord2 a) where
   texCoord :: TexCoord2 a -> IO ()
texCoord (TexCoord2 a
s a
t) = a -> a -> IO ()
forall a. TexCoordComponent a => a -> a -> IO ()
texCoord2 a
s a
t
   texCoordv :: Ptr (TexCoord2 a) -> IO ()
texCoordv = Ptr a -> IO ()
forall a. TexCoordComponent a => Ptr a -> IO ()
texCoord2v (Ptr a -> IO ())
-> (Ptr (TexCoord2 a) -> Ptr a) -> Ptr (TexCoord2 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (TexCoord2 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (TexCoord2 b) -> Ptr b)
   multiTexCoord :: TextureUnit -> TexCoord2 a -> IO ()
multiTexCoord TextureUnit
u (TexCoord2 a
s a
t) =
      GLuint -> a -> a -> IO ()
forall a. TexCoordComponent a => GLuint -> a -> a -> IO ()
multiTexCoord2 (TextureUnit -> GLuint
marshalTextureUnit TextureUnit
u) a
s a
t
   multiTexCoordv :: TextureUnit -> Ptr (TexCoord2 a) -> IO ()
multiTexCoordv TextureUnit
u =
      GLuint -> Ptr a -> IO ()
forall a. TexCoordComponent a => GLuint -> Ptr a -> IO ()
multiTexCoord2v (TextureUnit -> GLuint
marshalTextureUnit TextureUnit
u) (Ptr a -> IO ())
-> (Ptr (TexCoord2 a) -> Ptr a) -> Ptr (TexCoord2 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (TexCoord2 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (TexCoord2 b) -> Ptr b)

instance TexCoordComponent a => TexCoord (TexCoord3 a) where
   texCoord :: TexCoord3 a -> IO ()
texCoord (TexCoord3 a
s a
t a
r) = a -> a -> a -> IO ()
forall a. TexCoordComponent a => a -> a -> a -> IO ()
texCoord3 a
s a
t a
r
   texCoordv :: Ptr (TexCoord3 a) -> IO ()
texCoordv = Ptr a -> IO ()
forall a. TexCoordComponent a => Ptr a -> IO ()
texCoord3v (Ptr a -> IO ())
-> (Ptr (TexCoord3 a) -> Ptr a) -> Ptr (TexCoord3 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (TexCoord3 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (TexCoord3 b) -> Ptr b)
   multiTexCoord :: TextureUnit -> TexCoord3 a -> IO ()
multiTexCoord TextureUnit
u (TexCoord3 a
s a
t a
r) =
      GLuint -> a -> a -> a -> IO ()
forall a. TexCoordComponent a => GLuint -> a -> a -> a -> IO ()
multiTexCoord3 (TextureUnit -> GLuint
marshalTextureUnit TextureUnit
u) a
s a
t a
r
   multiTexCoordv :: TextureUnit -> Ptr (TexCoord3 a) -> IO ()
multiTexCoordv TextureUnit
u =
      GLuint -> Ptr a -> IO ()
forall a. TexCoordComponent a => GLuint -> Ptr a -> IO ()
multiTexCoord3v (TextureUnit -> GLuint
marshalTextureUnit TextureUnit
u) (Ptr a -> IO ())
-> (Ptr (TexCoord3 a) -> Ptr a) -> Ptr (TexCoord3 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (TexCoord3 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (TexCoord3 b) -> Ptr b)

instance TexCoordComponent a => TexCoord (TexCoord4 a) where
   texCoord :: TexCoord4 a -> IO ()
texCoord (TexCoord4 a
s a
t a
r a
q) = a -> a -> a -> a -> IO ()
forall a. TexCoordComponent a => a -> a -> a -> a -> IO ()
texCoord4 a
s a
t a
r a
q
   texCoordv :: Ptr (TexCoord4 a) -> IO ()
texCoordv = Ptr a -> IO ()
forall a. TexCoordComponent a => Ptr a -> IO ()
texCoord4v (Ptr a -> IO ())
-> (Ptr (TexCoord4 a) -> Ptr a) -> Ptr (TexCoord4 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (TexCoord4 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (TexCoord4 b) -> Ptr b)
   multiTexCoord :: TextureUnit -> TexCoord4 a -> IO ()
multiTexCoord TextureUnit
u (TexCoord4 a
s a
t a
r a
q) =
      GLuint -> a -> a -> a -> a -> IO ()
forall a.
TexCoordComponent a =>
GLuint -> a -> a -> a -> a -> IO ()
multiTexCoord4 (TextureUnit -> GLuint
marshalTextureUnit TextureUnit
u) a
s a
t a
r a
q
   multiTexCoordv :: TextureUnit -> Ptr (TexCoord4 a) -> IO ()
multiTexCoordv TextureUnit
u =
      GLuint -> Ptr a -> IO ()
forall a. TexCoordComponent a => GLuint -> Ptr a -> IO ()
multiTexCoord4v (TextureUnit -> GLuint
marshalTextureUnit TextureUnit
u) (Ptr a -> IO ())
-> (Ptr (TexCoord4 a) -> Ptr a) -> Ptr (TexCoord4 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (TexCoord4 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (TexCoord4 b) -> Ptr b)

--------------------------------------------------------------------------------

-- | The current normal (/x/, /y/, /z/). The initial value is the unit vector
-- (0, 0, 1).

currentNormal :: StateVar (Normal3 GLfloat)
currentNormal :: StateVar (Normal3 GLfloat)
currentNormal = IO (Normal3 GLfloat)
-> (Normal3 GLfloat -> IO ()) -> StateVar (Normal3 GLfloat)
forall a. IO a -> (a -> IO ()) -> StateVar a
makeStateVar ((GLfloat -> GLfloat -> GLfloat -> Normal3 GLfloat)
-> PName3F -> IO (Normal3 GLfloat)
forall p a.
GetPName3F p =>
(GLfloat -> GLfloat -> GLfloat -> a) -> p -> IO a
getFloat3 GLfloat -> GLfloat -> GLfloat -> Normal3 GLfloat
forall a. a -> a -> a -> Normal3 a
Normal3 PName3F
GetCurrentNormal) Normal3 GLfloat -> IO ()
forall a. Normal a => a -> IO ()
normal

--------------------------------------------------------------------------------

-- | The class of all types which can be used as a component of a normal.

class NormalComponent a where
   normal3 :: a -> a -> a -> IO ()
   normal3v :: Ptr a -> IO ()

instance NormalComponent GLbyte where
   normal3 :: GLbyte -> GLbyte -> GLbyte -> IO ()
normal3 = GLbyte -> GLbyte -> GLbyte -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLbyte -> GLbyte -> GLbyte -> m ()
glNormal3b
   normal3v :: Ptr GLbyte -> IO ()
normal3v = Ptr GLbyte -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLbyte -> m ()
glNormal3bv

instance NormalComponent GLshort where
   normal3 :: GLshort -> GLshort -> GLshort -> IO ()
normal3 = GLshort -> GLshort -> GLshort -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLshort -> GLshort -> GLshort -> m ()
glNormal3s
   normal3v :: Ptr GLshort -> IO ()
normal3v = Ptr GLshort -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLshort -> m ()
glNormal3sv

instance NormalComponent GLint where
   normal3 :: GLint -> GLint -> GLint -> IO ()
normal3 = GLint -> GLint -> GLint -> IO ()
forall (m :: * -> *). MonadIO m => GLint -> GLint -> GLint -> m ()
glNormal3i
   normal3v :: Ptr GLint -> IO ()
normal3v = Ptr GLint -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLint -> m ()
glNormal3iv

instance NormalComponent GLfloat where
   normal3 :: GLfloat -> GLfloat -> GLfloat -> IO ()
normal3 = GLfloat -> GLfloat -> GLfloat -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLfloat -> GLfloat -> GLfloat -> m ()
glNormal3f
   normal3v :: Ptr GLfloat -> IO ()
normal3v = Ptr GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLfloat -> m ()
glNormal3fv

instance NormalComponent GLdouble where
   normal3 :: GLdouble -> GLdouble -> GLdouble -> IO ()
normal3 = GLdouble -> GLdouble -> GLdouble -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLdouble -> GLdouble -> GLdouble -> m ()
glNormal3d
   normal3v :: Ptr GLdouble -> IO ()
normal3v = Ptr GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLdouble -> m ()
glNormal3dv

--------------------------------------------------------------------------------

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

class Normal a where
   normal  ::     a -> IO ()
   normalv :: Ptr a -> IO ()

instance NormalComponent a => Normal (Normal3 a) where
   normal :: Normal3 a -> IO ()
normal (Normal3 a
x a
y a
z) = a -> a -> a -> IO ()
forall a. NormalComponent a => a -> a -> a -> IO ()
normal3 a
x a
y a
z
   normalv :: Ptr (Normal3 a) -> IO ()
normalv = Ptr a -> IO ()
forall a. NormalComponent a => Ptr a -> IO ()
normal3v (Ptr a -> IO ())
-> (Ptr (Normal3 a) -> Ptr a) -> Ptr (Normal3 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Normal3 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Normal3 b) -> Ptr b)

--------------------------------------------------------------------------------

-- | The current fog coordinate. The initial value is 0.

currentFogCoord :: StateVar (FogCoord1 GLfloat)
currentFogCoord :: StateVar (FogCoord1 GLfloat)
currentFogCoord =
   IO (FogCoord1 GLfloat)
-> (FogCoord1 GLfloat -> IO ()) -> StateVar (FogCoord1 GLfloat)
forall a. IO a -> (a -> IO ()) -> StateVar a
makeStateVar ((GLfloat -> FogCoord1 GLfloat) -> PName1F -> IO (FogCoord1 GLfloat)
forall p a. GetPName1F p => (GLfloat -> a) -> p -> IO a
getFloat1 GLfloat -> FogCoord1 GLfloat
forall a. a -> FogCoord1 a
FogCoord1 PName1F
GetCurrentFogCoord) FogCoord1 GLfloat -> IO ()
forall a. FogCoord a => a -> IO ()
fogCoord

--------------------------------------------------------------------------------

-- | The class of all types which can be used as the fog coordinate.

class FogCoordComponent a where
   fogCoord1 :: a -> IO ()
   fogCoord1v :: Ptr a -> IO ()

instance FogCoordComponent GLfloat where
   fogCoord1 :: GLfloat -> IO ()
fogCoord1 = GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => GLfloat -> m ()
glFogCoordf
   fogCoord1v :: Ptr GLfloat -> IO ()
fogCoord1v = Ptr GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLfloat -> m ()
glFogCoordfv

instance FogCoordComponent GLdouble where
   fogCoord1 :: GLdouble -> IO ()
fogCoord1 = GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => GLdouble -> m ()
glFogCoordd
   fogCoord1v :: Ptr GLdouble -> IO ()
fogCoord1v = Ptr GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLdouble -> m ()
glFogCoorddv

--------------------------------------------------------------------------------

-- | Change the current fog coordinate.

class FogCoord a where
   fogCoord  ::     a -> IO ()
   fogCoordv :: Ptr a -> IO ()

instance FogCoordComponent a => FogCoord (FogCoord1 a) where
   fogCoord :: FogCoord1 a -> IO ()
fogCoord (FogCoord1 a
c) = a -> IO ()
forall a. FogCoordComponent a => a -> IO ()
fogCoord1 a
c
   fogCoordv :: Ptr (FogCoord1 a) -> IO ()
fogCoordv = Ptr a -> IO ()
forall a. FogCoordComponent a => Ptr a -> IO ()
fogCoord1v (Ptr a -> IO ())
-> (Ptr (FogCoord1 a) -> Ptr a) -> Ptr (FogCoord1 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (FogCoord1 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (FogCoord1 b) -> Ptr b)

--------------------------------------------------------------------------------

-- | If 'rgbaMode' contains 'True', the color buffers store RGBA value. If
-- color indexes are stored, it contains 'False'.

rgbaMode :: GettableStateVar Bool
rgbaMode :: GettableStateVar Bool
rgbaMode = GettableStateVar Bool -> GettableStateVar Bool
forall a. IO a -> IO a
makeGettableStateVar ((GLubyte -> Bool) -> PName1I -> GettableStateVar Bool
forall p a. GetPName1I p => (GLubyte -> a) -> p -> IO a
getBoolean1 GLubyte -> Bool
forall a. (Eq a, Num a) => a -> Bool
unmarshalGLboolean PName1I
GetRGBAMode)

--------------------------------------------------------------------------------

-- The current color (/R/, /G/, /B/, /A/). The initial value is (1, 1, 1, 1).
-- Note that this state variable is significant only when the GL is in RGBA
-- mode.

currentColor :: StateVar (Color4 GLfloat)
currentColor :: StateVar (Color4 GLfloat)
currentColor =
   IO (Color4 GLfloat)
-> (Color4 GLfloat -> IO ()) -> StateVar (Color4 GLfloat)
forall a. IO a -> (a -> IO ()) -> StateVar a
makeStateVar ((GLfloat -> GLfloat -> GLfloat -> GLfloat -> Color4 GLfloat)
-> PName4F -> IO (Color4 GLfloat)
forall p a.
GetPName4F p =>
(GLfloat -> GLfloat -> GLfloat -> GLfloat -> a) -> p -> IO a
getFloat4 GLfloat -> GLfloat -> GLfloat -> GLfloat -> Color4 GLfloat
forall a. a -> a -> a -> a -> Color4 a
Color4 PName4F
GetCurrentColor) Color4 GLfloat -> IO ()
forall a. Color a => a -> IO ()
color

-- The current secondary color (/R/, /G/, /B/). The initial value is (0, 0, 0).
-- Note that this state variable is significant only when the GL is in RGBA
-- mode.

currentSecondaryColor :: StateVar (Color3 GLfloat)
currentSecondaryColor :: StateVar (Color3 GLfloat)
currentSecondaryColor =
   IO (Color3 GLfloat)
-> (Color3 GLfloat -> IO ()) -> StateVar (Color3 GLfloat)
forall a. IO a -> (a -> IO ()) -> StateVar a
makeStateVar
      (do Color4 GLfloat
r GLfloat
g GLfloat
b GLfloat
_ <- (GLfloat -> GLfloat -> GLfloat -> GLfloat -> Color4 GLfloat)
-> PName4F -> IO (Color4 GLfloat)
forall p a.
GetPName4F p =>
(GLfloat -> GLfloat -> GLfloat -> GLfloat -> a) -> p -> IO a
getFloat4 GLfloat -> GLfloat -> GLfloat -> GLfloat -> Color4 GLfloat
forall a. a -> a -> a -> a -> Color4 a
Color4 PName4F
GetCurrentSecondaryColor
          Color3 GLfloat -> IO (Color3 GLfloat)
forall (m :: * -> *) a. Monad m => a -> m a
return (Color3 GLfloat -> IO (Color3 GLfloat))
-> Color3 GLfloat -> IO (Color3 GLfloat)
forall a b. (a -> b) -> a -> b
$ GLfloat -> GLfloat -> GLfloat -> Color3 GLfloat
forall a. a -> a -> a -> Color3 a
Color3 GLfloat
r GLfloat
g GLfloat
b)
      Color3 GLfloat -> IO ()
forall a. SecondaryColor a => a -> IO ()
secondaryColor

--------------------------------------------------------------------------------

-- | The class of all types which can be used as a color component.

class ColorComponent a where
   color3 :: a -> a -> a -> IO ()
   color4 :: a -> a -> a -> a -> IO ()

   color3v :: Ptr a -> IO ()
   color4v :: Ptr a -> IO ()

   secondaryColor3  :: a -> a -> a -> IO ()
   secondaryColor3v :: Ptr a -> IO ()

instance ColorComponent GLbyte where
   color3 :: GLbyte -> GLbyte -> GLbyte -> IO ()
color3 = GLbyte -> GLbyte -> GLbyte -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLbyte -> GLbyte -> GLbyte -> m ()
glColor3b
   color4 :: GLbyte -> GLbyte -> GLbyte -> GLbyte -> IO ()
color4 = GLbyte -> GLbyte -> GLbyte -> GLbyte -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLbyte -> GLbyte -> GLbyte -> GLbyte -> m ()
glColor4b

   color3v :: Ptr GLbyte -> IO ()
color3v = Ptr GLbyte -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLbyte -> m ()
glColor3bv
   color4v :: Ptr GLbyte -> IO ()
color4v = Ptr GLbyte -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLbyte -> m ()
glColor4bv

   secondaryColor3 :: GLbyte -> GLbyte -> GLbyte -> IO ()
secondaryColor3 = GLbyte -> GLbyte -> GLbyte -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLbyte -> GLbyte -> GLbyte -> m ()
glSecondaryColor3b
   secondaryColor3v :: Ptr GLbyte -> IO ()
secondaryColor3v = Ptr GLbyte -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLbyte -> m ()
glSecondaryColor3bv

instance ColorComponent GLshort where
   color3 :: GLshort -> GLshort -> GLshort -> IO ()
color3 = GLshort -> GLshort -> GLshort -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLshort -> GLshort -> GLshort -> m ()
glColor3s
   color4 :: GLshort -> GLshort -> GLshort -> GLshort -> IO ()
color4 = GLshort -> GLshort -> GLshort -> GLshort -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLshort -> GLshort -> GLshort -> GLshort -> m ()
glColor4s

   color3v :: Ptr GLshort -> IO ()
color3v = Ptr GLshort -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLshort -> m ()
glColor3sv
   color4v :: Ptr GLshort -> IO ()
color4v = Ptr GLshort -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLshort -> m ()
glColor4sv

   secondaryColor3 :: GLshort -> GLshort -> GLshort -> IO ()
secondaryColor3 = GLshort -> GLshort -> GLshort -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLshort -> GLshort -> GLshort -> m ()
glSecondaryColor3s
   secondaryColor3v :: Ptr GLshort -> IO ()
secondaryColor3v = Ptr GLshort -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLshort -> m ()
glSecondaryColor3sv

instance ColorComponent GLint where
   color3 :: GLint -> GLint -> GLint -> IO ()
color3 = GLint -> GLint -> GLint -> IO ()
forall (m :: * -> *). MonadIO m => GLint -> GLint -> GLint -> m ()
glColor3i
   color4 :: GLint -> GLint -> GLint -> GLint -> IO ()
color4 = GLint -> GLint -> GLint -> GLint -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLint -> GLint -> GLint -> GLint -> m ()
glColor4i

   color3v :: Ptr GLint -> IO ()
color3v = Ptr GLint -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLint -> m ()
glColor3iv
   color4v :: Ptr GLint -> IO ()
color4v = Ptr GLint -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLint -> m ()
glColor4iv

   secondaryColor3 :: GLint -> GLint -> GLint -> IO ()
secondaryColor3 = GLint -> GLint -> GLint -> IO ()
forall (m :: * -> *). MonadIO m => GLint -> GLint -> GLint -> m ()
glSecondaryColor3i
   secondaryColor3v :: Ptr GLint -> IO ()
secondaryColor3v = Ptr GLint -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLint -> m ()
glSecondaryColor3iv

instance ColorComponent GLfloat where
   color3 :: GLfloat -> GLfloat -> GLfloat -> IO ()
color3 = GLfloat -> GLfloat -> GLfloat -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLfloat -> GLfloat -> GLfloat -> m ()
glColor3f
   color4 :: GLfloat -> GLfloat -> GLfloat -> GLfloat -> IO ()
color4 = GLfloat -> GLfloat -> GLfloat -> GLfloat -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLfloat -> GLfloat -> GLfloat -> GLfloat -> m ()
glColor4f

   color3v :: Ptr GLfloat -> IO ()
color3v = Ptr GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLfloat -> m ()
glColor3fv
   color4v :: Ptr GLfloat -> IO ()
color4v = Ptr GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLfloat -> m ()
glColor4fv

   secondaryColor3 :: GLfloat -> GLfloat -> GLfloat -> IO ()
secondaryColor3 = GLfloat -> GLfloat -> GLfloat -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLfloat -> GLfloat -> GLfloat -> m ()
glSecondaryColor3f
   secondaryColor3v :: Ptr GLfloat -> IO ()
secondaryColor3v = Ptr GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLfloat -> m ()
glSecondaryColor3fv

instance ColorComponent GLdouble where
   color3 :: GLdouble -> GLdouble -> GLdouble -> IO ()
color3 = GLdouble -> GLdouble -> GLdouble -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLdouble -> GLdouble -> GLdouble -> m ()
glColor3d
   color4 :: GLdouble -> GLdouble -> GLdouble -> GLdouble -> IO ()
color4 = GLdouble -> GLdouble -> GLdouble -> GLdouble -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLdouble -> GLdouble -> GLdouble -> GLdouble -> m ()
glColor4d

   color3v :: Ptr GLdouble -> IO ()
color3v = Ptr GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLdouble -> m ()
glColor3dv
   color4v :: Ptr GLdouble -> IO ()
color4v = Ptr GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLdouble -> m ()
glColor4dv

   secondaryColor3 :: GLdouble -> GLdouble -> GLdouble -> IO ()
secondaryColor3 = GLdouble -> GLdouble -> GLdouble -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLdouble -> GLdouble -> GLdouble -> m ()
glSecondaryColor3d
   secondaryColor3v :: Ptr GLdouble -> IO ()
secondaryColor3v = Ptr GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLdouble -> m ()
glSecondaryColor3dv

instance ColorComponent GLubyte where
   color3 :: GLubyte -> GLubyte -> GLubyte -> IO ()
color3 = GLubyte -> GLubyte -> GLubyte -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLubyte -> GLubyte -> GLubyte -> m ()
glColor3ub
   color4 :: GLubyte -> GLubyte -> GLubyte -> GLubyte -> IO ()
color4 = GLubyte -> GLubyte -> GLubyte -> GLubyte -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLubyte -> GLubyte -> GLubyte -> GLubyte -> m ()
glColor4ub

   color3v :: Ptr GLubyte -> IO ()
color3v = Ptr GLubyte -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLubyte -> m ()
glColor3ubv
   color4v :: Ptr GLubyte -> IO ()
color4v = Ptr GLubyte -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLubyte -> m ()
glColor4ubv

   secondaryColor3 :: GLubyte -> GLubyte -> GLubyte -> IO ()
secondaryColor3 = GLubyte -> GLubyte -> GLubyte -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLubyte -> GLubyte -> GLubyte -> m ()
glSecondaryColor3ub
   secondaryColor3v :: Ptr GLubyte -> IO ()
secondaryColor3v = Ptr GLubyte -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLubyte -> m ()
glSecondaryColor3ubv

instance ColorComponent GLushort where
   color3 :: GLushort -> GLushort -> GLushort -> IO ()
color3 = GLushort -> GLushort -> GLushort -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLushort -> GLushort -> GLushort -> m ()
glColor3us
   color4 :: GLushort -> GLushort -> GLushort -> GLushort -> IO ()
color4 = GLushort -> GLushort -> GLushort -> GLushort -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLushort -> GLushort -> GLushort -> GLushort -> m ()
glColor4us

   color3v :: Ptr GLushort -> IO ()
color3v = Ptr GLushort -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLushort -> m ()
glColor3usv
   color4v :: Ptr GLushort -> IO ()
color4v = Ptr GLushort -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLushort -> m ()
glColor4usv

   secondaryColor3 :: GLushort -> GLushort -> GLushort -> IO ()
secondaryColor3 = GLushort -> GLushort -> GLushort -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLushort -> GLushort -> GLushort -> m ()
glSecondaryColor3us
   secondaryColor3v :: Ptr GLushort -> IO ()
secondaryColor3v = Ptr GLushort -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLushort -> m ()
glSecondaryColor3usv

instance ColorComponent GLuint where
   color3 :: GLuint -> GLuint -> GLuint -> IO ()
color3 = GLuint -> GLuint -> GLuint -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLuint -> GLuint -> m ()
glColor3ui
   color4 :: GLuint -> GLuint -> GLuint -> GLuint -> IO ()
color4 = GLuint -> GLuint -> GLuint -> GLuint -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLuint -> GLuint -> GLuint -> m ()
glColor4ui

   color3v :: Ptr GLuint -> IO ()
color3v = Ptr GLuint -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLuint -> m ()
glColor3uiv
   color4v :: Ptr GLuint -> IO ()
color4v = Ptr GLuint -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLuint -> m ()
glColor4uiv

   secondaryColor3 :: GLuint -> GLuint -> GLuint -> IO ()
secondaryColor3 = GLuint -> GLuint -> GLuint -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLuint -> GLuint -> m ()
glSecondaryColor3ui
   secondaryColor3v :: Ptr GLuint -> IO ()
secondaryColor3v = Ptr GLuint -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLuint -> m ()
glSecondaryColor3uiv

--------------------------------------------------------------------------------

-- | Change the current color.

class Color a where
   color  ::     a -> IO ()
   colorv :: Ptr a -> IO ()

instance ColorComponent a => Color (Color3 a) where
   color :: Color3 a -> IO ()
color (Color3 a
r a
g a
b) = a -> a -> a -> IO ()
forall a. ColorComponent a => a -> a -> a -> IO ()
color3 a
r a
g a
b
   colorv :: Ptr (Color3 a) -> IO ()
colorv = Ptr a -> IO ()
forall a. ColorComponent a => Ptr a -> IO ()
color3v (Ptr a -> IO ())
-> (Ptr (Color3 a) -> Ptr a) -> Ptr (Color3 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Color3 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Color3 b) -> Ptr b)

instance ColorComponent a => Color (Color4 a) where
   color :: Color4 a -> IO ()
color (Color4 a
r a
g a
b a
a) = a -> a -> a -> a -> IO ()
forall a. ColorComponent a => a -> a -> a -> a -> IO ()
color4 a
r a
g a
b a
a
   colorv :: Ptr (Color4 a) -> IO ()
colorv = Ptr a -> IO ()
forall a. ColorComponent a => Ptr a -> IO ()
color4v (Ptr a -> IO ())
-> (Ptr (Color4 a) -> Ptr a) -> Ptr (Color4 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Color4 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Color4 b) -> Ptr b)

--------------------------------------------------------------------------------

-- | Change the current secondary color.

class SecondaryColor a where
   secondaryColor  ::     a -> IO ()
   secondaryColorv :: Ptr a -> IO ()

instance ColorComponent a => SecondaryColor (Color3 a) where
   secondaryColor :: Color3 a -> IO ()
secondaryColor (Color3 a
r a
g a
b) = a -> a -> a -> IO ()
forall a. ColorComponent a => a -> a -> a -> IO ()
secondaryColor3 a
r a
g a
b
   secondaryColorv :: Ptr (Color3 a) -> IO ()
secondaryColorv = Ptr a -> IO ()
forall a. ColorComponent a => Ptr a -> IO ()
secondaryColor3v (Ptr a -> IO ())
-> (Ptr (Color3 a) -> Ptr a) -> Ptr (Color3 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Color3 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Color3 b) -> Ptr b)

--------------------------------------------------------------------------------

-- The current color index. The initial value is 1. Note that this state
-- variable is significant only when the GL is in color index mode.

currentIndex :: StateVar (Index1 GLint)
currentIndex :: StateVar (Index1 GLint)
currentIndex = IO (Index1 GLint)
-> (Index1 GLint -> IO ()) -> StateVar (Index1 GLint)
forall a. IO a -> (a -> IO ()) -> StateVar a
makeStateVar ((GLint -> Index1 GLint) -> PName1I -> IO (Index1 GLint)
forall p a. GetPName1I p => (GLint -> a) -> p -> IO a
getInteger1 GLint -> Index1 GLint
forall a. a -> Index1 a
Index1 PName1I
GetCurrentIndex) Index1 GLint -> IO ()
forall a. Index a => a -> IO ()
index

--------------------------------------------------------------------------------

-- | The class of all types which can be used as a color index.

class IndexComponent a where
   index1 :: a -> IO ()
   index1v :: Ptr a -> IO ()

instance IndexComponent GLshort where
   index1 :: GLshort -> IO ()
index1 = GLshort -> IO ()
forall (m :: * -> *). MonadIO m => GLshort -> m ()
glIndexs
   index1v :: Ptr GLshort -> IO ()
index1v = Ptr GLshort -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLshort -> m ()
glIndexsv

instance IndexComponent GLint where
   index1 :: GLint -> IO ()
index1 = GLint -> IO ()
forall (m :: * -> *). MonadIO m => GLint -> m ()
glIndexi
   index1v :: Ptr GLint -> IO ()
index1v = Ptr GLint -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLint -> m ()
glIndexiv

instance IndexComponent GLfloat where
   index1 :: GLfloat -> IO ()
index1 = GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => GLfloat -> m ()
glIndexf
   index1v :: Ptr GLfloat -> IO ()
index1v = Ptr GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLfloat -> m ()
glIndexfv

instance IndexComponent GLdouble where
   index1 :: GLdouble -> IO ()
index1 = GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => GLdouble -> m ()
glIndexd
   index1v :: Ptr GLdouble -> IO ()
index1v = Ptr GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLdouble -> m ()
glIndexdv

instance IndexComponent GLubyte where
   index1 :: GLubyte -> IO ()
index1 = GLubyte -> IO ()
forall (m :: * -> *). MonadIO m => GLubyte -> m ()
glIndexub
   index1v :: Ptr GLubyte -> IO ()
index1v = Ptr GLubyte -> IO ()
forall (m :: * -> *). MonadIO m => Ptr GLubyte -> m ()
glIndexubv

--------------------------------------------------------------------------------

-- | Change the current color index.

class Index a where
   index  ::     a -> IO ()  -- Collision with Prelude.index
   indexv :: Ptr a -> IO ()

instance IndexComponent a => Index (Index1 a) where
   index :: Index1 a -> IO ()
index (Index1 a
i) = a -> IO ()
forall a. IndexComponent a => a -> IO ()
index1 a
i
   indexv :: Ptr (Index1 a) -> IO ()
indexv = Ptr a -> IO ()
forall a. IndexComponent a => Ptr a -> IO ()
index1v (Ptr a -> IO ())
-> (Ptr (Index1 a) -> Ptr a) -> Ptr (Index1 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Index1 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Index1 b) -> Ptr b)

--------------------------------------------------------------------------------

data IntegerHandling =
     ToFloat
   | ToNormalizedFloat
   | KeepIntegral
   deriving ( IntegerHandling -> IntegerHandling -> Bool
(IntegerHandling -> IntegerHandling -> Bool)
-> (IntegerHandling -> IntegerHandling -> Bool)
-> Eq IntegerHandling
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IntegerHandling -> IntegerHandling -> Bool
$c/= :: IntegerHandling -> IntegerHandling -> Bool
== :: IntegerHandling -> IntegerHandling -> Bool
$c== :: IntegerHandling -> IntegerHandling -> Bool
Eq, Eq IntegerHandling
Eq IntegerHandling
-> (IntegerHandling -> IntegerHandling -> Ordering)
-> (IntegerHandling -> IntegerHandling -> Bool)
-> (IntegerHandling -> IntegerHandling -> Bool)
-> (IntegerHandling -> IntegerHandling -> Bool)
-> (IntegerHandling -> IntegerHandling -> Bool)
-> (IntegerHandling -> IntegerHandling -> IntegerHandling)
-> (IntegerHandling -> IntegerHandling -> IntegerHandling)
-> Ord IntegerHandling
IntegerHandling -> IntegerHandling -> Bool
IntegerHandling -> IntegerHandling -> Ordering
IntegerHandling -> IntegerHandling -> IntegerHandling
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: IntegerHandling -> IntegerHandling -> IntegerHandling
$cmin :: IntegerHandling -> IntegerHandling -> IntegerHandling
max :: IntegerHandling -> IntegerHandling -> IntegerHandling
$cmax :: IntegerHandling -> IntegerHandling -> IntegerHandling
>= :: IntegerHandling -> IntegerHandling -> Bool
$c>= :: IntegerHandling -> IntegerHandling -> Bool
> :: IntegerHandling -> IntegerHandling -> Bool
$c> :: IntegerHandling -> IntegerHandling -> Bool
<= :: IntegerHandling -> IntegerHandling -> Bool
$c<= :: IntegerHandling -> IntegerHandling -> Bool
< :: IntegerHandling -> IntegerHandling -> Bool
$c< :: IntegerHandling -> IntegerHandling -> Bool
compare :: IntegerHandling -> IntegerHandling -> Ordering
$ccompare :: IntegerHandling -> IntegerHandling -> Ordering
Ord, Int -> IntegerHandling -> ShowS
[IntegerHandling] -> ShowS
IntegerHandling -> String
(Int -> IntegerHandling -> ShowS)
-> (IntegerHandling -> String)
-> ([IntegerHandling] -> ShowS)
-> Show IntegerHandling
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IntegerHandling] -> ShowS
$cshowList :: [IntegerHandling] -> ShowS
show :: IntegerHandling -> String
$cshow :: IntegerHandling -> String
showsPrec :: Int -> IntegerHandling -> ShowS
$cshowsPrec :: Int -> IntegerHandling -> ShowS
Show )

--------------------------------------------------------------------------------

currentVertexAttrib :: AttribLocation -> StateVar (Vertex4 GLfloat)
currentVertexAttrib :: AttribLocation -> StateVar (Vertex4 GLfloat)
currentVertexAttrib AttribLocation
location =
   IO (Vertex4 GLfloat)
-> (Vertex4 GLfloat -> IO ()) -> StateVar (Vertex4 GLfloat)
forall a. IO a -> (a -> IO ()) -> StateVar a
makeStateVar
      ((GLfloat -> GLfloat -> GLfloat -> GLfloat -> Vertex4 GLfloat)
-> AttribLocation -> GetVertexAttribPName -> IO (Vertex4 GLfloat)
forall b.
(GLfloat -> GLfloat -> GLfloat -> GLfloat -> b)
-> AttribLocation -> GetVertexAttribPName -> IO b
getVertexAttribFloat4 GLfloat -> GLfloat -> GLfloat -> GLfloat -> Vertex4 GLfloat
forall a. a -> a -> a -> a -> Vertex4 a
Vertex4 AttribLocation
location GetVertexAttribPName
GetCurrentVertexAttrib)
      (IntegerHandling -> AttribLocation -> Vertex4 GLfloat -> IO ()
forall a.
VertexAttrib a =>
IntegerHandling -> AttribLocation -> a -> IO ()
vertexAttrib IntegerHandling
ToFloat AttribLocation
location)

currentVertexAttribI :: AttribLocation -> StateVar (Vertex4 GLint)
currentVertexAttribI :: AttribLocation -> StateVar (Vertex4 GLint)
currentVertexAttribI AttribLocation
location =
   IO (Vertex4 GLint)
-> (Vertex4 GLint -> IO ()) -> StateVar (Vertex4 GLint)
forall a. IO a -> (a -> IO ()) -> StateVar a
makeStateVar
      ((GLint -> GLint -> GLint -> GLint -> Vertex4 GLint)
-> AttribLocation -> GetVertexAttribPName -> IO (Vertex4 GLint)
forall b.
(GLint -> GLint -> GLint -> GLint -> b)
-> AttribLocation -> GetVertexAttribPName -> IO b
getVertexAttribIInteger4 GLint -> GLint -> GLint -> GLint -> Vertex4 GLint
forall a. a -> a -> a -> a -> Vertex4 a
Vertex4 AttribLocation
location GetVertexAttribPName
GetCurrentVertexAttrib)
      (IntegerHandling -> AttribLocation -> Vertex4 GLint -> IO ()
forall a.
VertexAttrib a =>
IntegerHandling -> AttribLocation -> a -> IO ()
vertexAttrib IntegerHandling
ToNormalizedFloat AttribLocation
location)

currentVertexAttribIu :: AttribLocation -> StateVar (Vertex4 GLuint)
currentVertexAttribIu :: AttribLocation -> StateVar (Vertex4 GLuint)
currentVertexAttribIu AttribLocation
location =
   IO (Vertex4 GLuint)
-> (Vertex4 GLuint -> IO ()) -> StateVar (Vertex4 GLuint)
forall a. IO a -> (a -> IO ()) -> StateVar a
makeStateVar
      ((GLuint -> GLuint -> GLuint -> GLuint -> Vertex4 GLuint)
-> AttribLocation -> GetVertexAttribPName -> IO (Vertex4 GLuint)
forall b.
(GLuint -> GLuint -> GLuint -> GLuint -> b)
-> AttribLocation -> GetVertexAttribPName -> IO b
getVertexAttribIuInteger4 GLuint -> GLuint -> GLuint -> GLuint -> Vertex4 GLuint
forall a. a -> a -> a -> a -> Vertex4 a
Vertex4 AttribLocation
location GetVertexAttribPName
GetCurrentVertexAttrib)
      (IntegerHandling -> AttribLocation -> Vertex4 GLuint -> IO ()
forall a.
VertexAttrib a =>
IntegerHandling -> AttribLocation -> a -> IO ()
vertexAttrib IntegerHandling
KeepIntegral AttribLocation
location)

--------------------------------------------------------------------------------
-- The generic vertex attribute API is not as orthogonal as we would like.
-- Minimal methods: vertexAttrib4v and vertexAttrib4Nv and vertexAttrib4Iv

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

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 ()

   vertexAttrib1 AttribLocation
location a
x = AttribLocation -> a -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> a -> IO ()
vertexAttrib4 AttribLocation
location a
x a
0 a
0 a
1
   vertexAttrib2 AttribLocation
location a
x a
y = AttribLocation -> a -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> a -> IO ()
vertexAttrib4 AttribLocation
location a
x a
y a
0 a
1
   vertexAttrib3 AttribLocation
location a
x a
y a
z = AttribLocation -> a -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> a -> IO ()
vertexAttrib4 AttribLocation
location a
x a
y a
z a
1
   vertexAttrib4 AttribLocation
location a
x a
y a
z a
w = Int -> (Ptr a -> IO ()) -> IO ()
forall a b. Storable a => Int -> (Ptr a -> IO b) -> IO b
allocaArray Int
4 ((Ptr a -> IO ()) -> IO ()) -> (Ptr a -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr a
buf -> do
                                       Ptr a -> a -> a -> a -> a -> IO ()
forall a. Storable a => Ptr a -> a -> a -> a -> a -> IO ()
poke4 Ptr a
buf a
x a
y a
z a
w
                                       AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib4v AttribLocation
location Ptr a
buf

   vertexAttrib1N AttribLocation
location a
x = AttribLocation -> a -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> a -> IO ()
vertexAttrib4N AttribLocation
location a
x a
0 a
0 a
1
   vertexAttrib2N AttribLocation
location a
x a
y = AttribLocation -> a -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> a -> IO ()
vertexAttrib4N AttribLocation
location a
x a
y a
0 a
1
   vertexAttrib3N AttribLocation
location a
x a
y a
z = AttribLocation -> a -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> a -> IO ()
vertexAttrib4N AttribLocation
location a
x a
y a
z a
1
   vertexAttrib4N AttribLocation
location a
x a
y a
z a
w = Int -> (Ptr a -> IO ()) -> IO ()
forall a b. Storable a => Int -> (Ptr a -> IO b) -> IO b
allocaArray Int
4 ((Ptr a -> IO ()) -> IO ()) -> (Ptr a -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr a
buf -> do
                                       Ptr a -> a -> a -> a -> a -> IO ()
forall a. Storable a => Ptr a -> a -> a -> a -> a -> IO ()
poke4 Ptr a
buf a
x a
y a
z a
w
                                       AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib4Nv AttribLocation
location Ptr a
buf

   vertexAttrib1I AttribLocation
location a
x = AttribLocation -> a -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> a -> IO ()
vertexAttrib4I AttribLocation
location a
x a
0 a
0 a
1
   vertexAttrib2I AttribLocation
location a
x a
y = AttribLocation -> a -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> a -> IO ()
vertexAttrib4I AttribLocation
location a
x a
y a
0 a
1
   vertexAttrib3I AttribLocation
location a
x a
y a
z = AttribLocation -> a -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> a -> IO ()
vertexAttrib4I AttribLocation
location a
x a
y a
z a
1
   vertexAttrib4I AttribLocation
location a
x a
y a
z a
w = Int -> (Ptr a -> IO ()) -> IO ()
forall a b. Storable a => Int -> (Ptr a -> IO b) -> IO b
allocaArray Int
4 ((Ptr a -> IO ()) -> IO ()) -> (Ptr a -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr a
buf -> do
                                       Ptr a -> a -> a -> a -> a -> IO ()
forall a. Storable a => Ptr a -> a -> a -> a -> a -> IO ()
poke4 Ptr a
buf a
x a
y a
z a
w
                                       AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib4Iv AttribLocation
location Ptr a
buf

   vertexAttrib1v AttribLocation
location = (a -> IO ()) -> Ptr a -> IO ()
forall a b. Storable a => (a -> IO b) -> Ptr a -> IO b
peek1M ((a -> IO ()) -> Ptr a -> IO ()) -> (a -> IO ()) -> Ptr a -> IO ()
forall a b. (a -> b) -> a -> b
$ AttribLocation -> a -> IO ()
forall a. VertexAttribComponent a => AttribLocation -> a -> IO ()
vertexAttrib1 AttribLocation
location
   vertexAttrib2v AttribLocation
location = (a -> a -> IO ()) -> Ptr a -> IO ()
forall a b. Storable a => (a -> a -> IO b) -> Ptr a -> IO b
peek2M ((a -> a -> IO ()) -> Ptr a -> IO ())
-> (a -> a -> IO ()) -> Ptr a -> IO ()
forall a b. (a -> b) -> a -> b
$ AttribLocation -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> IO ()
vertexAttrib2 AttribLocation
location
   vertexAttrib3v AttribLocation
location = (a -> a -> a -> IO ()) -> Ptr a -> IO ()
forall a b. Storable a => (a -> a -> a -> IO b) -> Ptr a -> IO b
peek3M ((a -> a -> a -> IO ()) -> Ptr a -> IO ())
-> (a -> a -> a -> IO ()) -> Ptr a -> IO ()
forall a b. (a -> b) -> a -> b
$ AttribLocation -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> IO ()
vertexAttrib3 AttribLocation
location

   vertexAttrib1Nv AttribLocation
location = (a -> IO ()) -> Ptr a -> IO ()
forall a b. Storable a => (a -> IO b) -> Ptr a -> IO b
peek1M ((a -> IO ()) -> Ptr a -> IO ()) -> (a -> IO ()) -> Ptr a -> IO ()
forall a b. (a -> b) -> a -> b
$ AttribLocation -> a -> IO ()
forall a. VertexAttribComponent a => AttribLocation -> a -> IO ()
vertexAttrib1N AttribLocation
location
   vertexAttrib2Nv AttribLocation
location = (a -> a -> IO ()) -> Ptr a -> IO ()
forall a b. Storable a => (a -> a -> IO b) -> Ptr a -> IO b
peek2M ((a -> a -> IO ()) -> Ptr a -> IO ())
-> (a -> a -> IO ()) -> Ptr a -> IO ()
forall a b. (a -> b) -> a -> b
$ AttribLocation -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> IO ()
vertexAttrib2N AttribLocation
location
   vertexAttrib3Nv AttribLocation
location = (a -> a -> a -> IO ()) -> Ptr a -> IO ()
forall a b. Storable a => (a -> a -> a -> IO b) -> Ptr a -> IO b
peek3M ((a -> a -> a -> IO ()) -> Ptr a -> IO ())
-> (a -> a -> a -> IO ()) -> Ptr a -> IO ()
forall a b. (a -> b) -> a -> b
$ AttribLocation -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> IO ()
vertexAttrib3N AttribLocation
location

   vertexAttrib1Iv AttribLocation
location = (a -> IO ()) -> Ptr a -> IO ()
forall a b. Storable a => (a -> IO b) -> Ptr a -> IO b
peek1M ((a -> IO ()) -> Ptr a -> IO ()) -> (a -> IO ()) -> Ptr a -> IO ()
forall a b. (a -> b) -> a -> b
$ AttribLocation -> a -> IO ()
forall a. VertexAttribComponent a => AttribLocation -> a -> IO ()
vertexAttrib1I AttribLocation
location
   vertexAttrib2Iv AttribLocation
location = (a -> a -> IO ()) -> Ptr a -> IO ()
forall a b. Storable a => (a -> a -> IO b) -> Ptr a -> IO b
peek2M ((a -> a -> IO ()) -> Ptr a -> IO ())
-> (a -> a -> IO ()) -> Ptr a -> IO ()
forall a b. (a -> b) -> a -> b
$ AttribLocation -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> IO ()
vertexAttrib2I AttribLocation
location
   vertexAttrib3Iv AttribLocation
location = (a -> a -> a -> IO ()) -> Ptr a -> IO ()
forall a b. Storable a => (a -> a -> a -> IO b) -> Ptr a -> IO b
peek3M ((a -> a -> a -> IO ()) -> Ptr a -> IO ())
-> (a -> a -> a -> IO ()) -> Ptr a -> IO ()
forall a b. (a -> b) -> a -> b
$ AttribLocation -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> IO ()
vertexAttrib3I AttribLocation
location

instance VertexAttribComponent GLbyte where
   vertexAttrib4v :: AttribLocation -> Ptr GLbyte -> IO ()
vertexAttrib4v (AttribLocation GLuint
al) = GLuint -> Ptr GLbyte -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLbyte -> m ()
glVertexAttrib4bv GLuint
al
   vertexAttrib4Nv :: AttribLocation -> Ptr GLbyte -> IO ()
vertexAttrib4Nv (AttribLocation GLuint
al) = GLuint -> Ptr GLbyte -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLbyte -> m ()
glVertexAttrib4Nbv GLuint
al
   vertexAttrib4Iv :: AttribLocation -> Ptr GLbyte -> IO ()
vertexAttrib4Iv (AttribLocation GLuint
al) = GLuint -> Ptr GLbyte -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLbyte -> m ()
glVertexAttribI4bv GLuint
al

instance VertexAttribComponent GLubyte where
   vertexAttrib4N :: AttribLocation -> GLubyte -> GLubyte -> GLubyte -> GLubyte -> IO ()
vertexAttrib4N (AttribLocation GLuint
al) = GLuint -> GLubyte -> GLubyte -> GLubyte -> GLubyte -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLubyte -> GLubyte -> GLubyte -> GLubyte -> m ()
glVertexAttrib4Nub GLuint
al
   vertexAttrib4v :: AttribLocation -> Ptr GLubyte -> IO ()
vertexAttrib4v (AttribLocation GLuint
al) = GLuint -> Ptr GLubyte -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLubyte -> m ()
glVertexAttrib4ubv GLuint
al
   vertexAttrib4Nv :: AttribLocation -> Ptr GLubyte -> IO ()
vertexAttrib4Nv (AttribLocation GLuint
al) = GLuint -> Ptr GLubyte -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLubyte -> m ()
glVertexAttrib4Nubv GLuint
al
   vertexAttrib4Iv :: AttribLocation -> Ptr GLubyte -> IO ()
vertexAttrib4Iv (AttribLocation GLuint
al) = GLuint -> Ptr GLubyte -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLubyte -> m ()
glVertexAttribI4ubv GLuint
al

instance VertexAttribComponent GLshort where
   vertexAttrib1 :: AttribLocation -> GLshort -> IO ()
vertexAttrib1 (AttribLocation GLuint
al) = GLuint -> GLshort -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> GLshort -> m ()
glVertexAttrib1s GLuint
al
   vertexAttrib2 :: AttribLocation -> GLshort -> GLshort -> IO ()
vertexAttrib2 (AttribLocation GLuint
al) = GLuint -> GLshort -> GLshort -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLshort -> GLshort -> m ()
glVertexAttrib2s GLuint
al
   vertexAttrib3 :: AttribLocation -> GLshort -> GLshort -> GLshort -> IO ()
vertexAttrib3 (AttribLocation GLuint
al) = GLuint -> GLshort -> GLshort -> GLshort -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLshort -> GLshort -> GLshort -> m ()
glVertexAttrib3s GLuint
al
   vertexAttrib4 :: AttribLocation -> GLshort -> GLshort -> GLshort -> GLshort -> IO ()
vertexAttrib4 (AttribLocation GLuint
al) = GLuint -> GLshort -> GLshort -> GLshort -> GLshort -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLshort -> GLshort -> GLshort -> GLshort -> m ()
glVertexAttrib4s GLuint
al

   vertexAttrib1v :: AttribLocation -> Ptr GLshort -> IO ()
vertexAttrib1v (AttribLocation GLuint
al) = GLuint -> Ptr GLshort -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLshort -> m ()
glVertexAttrib1sv GLuint
al
   vertexAttrib2v :: AttribLocation -> Ptr GLshort -> IO ()
vertexAttrib2v (AttribLocation GLuint
al) = GLuint -> Ptr GLshort -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLshort -> m ()
glVertexAttrib2sv GLuint
al
   vertexAttrib3v :: AttribLocation -> Ptr GLshort -> IO ()
vertexAttrib3v (AttribLocation GLuint
al) = GLuint -> Ptr GLshort -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLshort -> m ()
glVertexAttrib3sv GLuint
al
   vertexAttrib4v :: AttribLocation -> Ptr GLshort -> IO ()
vertexAttrib4v (AttribLocation GLuint
al) = GLuint -> Ptr GLshort -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLshort -> m ()
glVertexAttrib4sv GLuint
al

   vertexAttrib4Nv :: AttribLocation -> Ptr GLshort -> IO ()
vertexAttrib4Nv (AttribLocation GLuint
al) = GLuint -> Ptr GLshort -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLshort -> m ()
glVertexAttrib4Nsv GLuint
al

   vertexAttrib4Iv :: AttribLocation -> Ptr GLshort -> IO ()
vertexAttrib4Iv (AttribLocation GLuint
al) = GLuint -> Ptr GLshort -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLshort -> m ()
glVertexAttribI4sv GLuint
al

instance VertexAttribComponent GLushort where
   vertexAttrib4v :: AttribLocation -> Ptr GLushort -> IO ()
vertexAttrib4v (AttribLocation GLuint
al) = GLuint -> Ptr GLushort -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLushort -> m ()
glVertexAttrib4usv GLuint
al
   vertexAttrib4Nv :: AttribLocation -> Ptr GLushort -> IO ()
vertexAttrib4Nv (AttribLocation GLuint
al) = GLuint -> Ptr GLushort -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLushort -> m ()
glVertexAttrib4Nusv GLuint
al
   vertexAttrib4Iv :: AttribLocation -> Ptr GLushort -> IO ()
vertexAttrib4Iv (AttribLocation GLuint
al) = GLuint -> Ptr GLushort -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLushort -> m ()
glVertexAttribI4usv GLuint
al

instance VertexAttribComponent GLint where
   vertexAttrib1I :: AttribLocation -> GLint -> IO ()
vertexAttrib1I (AttribLocation GLuint
al) = GLuint -> GLint -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> GLint -> m ()
glVertexAttribI1i GLuint
al
   vertexAttrib2I :: AttribLocation -> GLint -> GLint -> IO ()
vertexAttrib2I (AttribLocation GLuint
al) = GLuint -> GLint -> GLint -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> GLint -> GLint -> m ()
glVertexAttribI2i GLuint
al
   vertexAttrib3I :: AttribLocation -> GLint -> GLint -> GLint -> IO ()
vertexAttrib3I (AttribLocation GLuint
al) = GLuint -> GLint -> GLint -> GLint -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLint -> GLint -> GLint -> m ()
glVertexAttribI3i GLuint
al
   vertexAttrib4I :: AttribLocation -> GLint -> GLint -> GLint -> GLint -> IO ()
vertexAttrib4I (AttribLocation GLuint
al) = GLuint -> GLint -> GLint -> GLint -> GLint -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLint -> GLint -> GLint -> GLint -> m ()
glVertexAttribI4i GLuint
al

   vertexAttrib4v :: AttribLocation -> Ptr GLint -> IO ()
vertexAttrib4v (AttribLocation GLuint
al) = GLuint -> Ptr GLint -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLint -> m ()
glVertexAttrib4iv GLuint
al

   vertexAttrib4Nv :: AttribLocation -> Ptr GLint -> IO ()
vertexAttrib4Nv (AttribLocation GLuint
al) = GLuint -> Ptr GLint -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLint -> m ()
glVertexAttrib4Niv GLuint
al

   vertexAttrib1Iv :: AttribLocation -> Ptr GLint -> IO ()
vertexAttrib1Iv (AttribLocation GLuint
al) = GLuint -> Ptr GLint -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLint -> m ()
glVertexAttribI1iv GLuint
al
   vertexAttrib2Iv :: AttribLocation -> Ptr GLint -> IO ()
vertexAttrib2Iv (AttribLocation GLuint
al) = GLuint -> Ptr GLint -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLint -> m ()
glVertexAttribI2iv GLuint
al
   vertexAttrib3Iv :: AttribLocation -> Ptr GLint -> IO ()
vertexAttrib3Iv (AttribLocation GLuint
al) = GLuint -> Ptr GLint -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLint -> m ()
glVertexAttribI3iv GLuint
al
   vertexAttrib4Iv :: AttribLocation -> Ptr GLint -> IO ()
vertexAttrib4Iv (AttribLocation GLuint
al) = GLuint -> Ptr GLint -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLint -> m ()
glVertexAttribI4iv GLuint
al

instance VertexAttribComponent GLuint where
   vertexAttrib1I :: AttribLocation -> GLuint -> IO ()
vertexAttrib1I (AttribLocation GLuint
al) = GLuint -> GLuint -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> GLuint -> m ()
glVertexAttribI1ui GLuint
al
   vertexAttrib2I :: AttribLocation -> GLuint -> GLuint -> IO ()
vertexAttrib2I (AttribLocation GLuint
al) = GLuint -> GLuint -> GLuint -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLuint -> GLuint -> m ()
glVertexAttribI2ui GLuint
al
   vertexAttrib3I :: AttribLocation -> GLuint -> GLuint -> GLuint -> IO ()
vertexAttrib3I (AttribLocation GLuint
al) = GLuint -> GLuint -> GLuint -> GLuint -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLuint -> GLuint -> GLuint -> m ()
glVertexAttribI3ui GLuint
al
   vertexAttrib4I :: AttribLocation -> GLuint -> GLuint -> GLuint -> GLuint -> IO ()
vertexAttrib4I (AttribLocation GLuint
al) = GLuint -> GLuint -> GLuint -> GLuint -> GLuint -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLuint -> GLuint -> GLuint -> GLuint -> m ()
glVertexAttribI4ui GLuint
al

   vertexAttrib4v :: AttribLocation -> Ptr GLuint -> IO ()
vertexAttrib4v (AttribLocation GLuint
al) = GLuint -> Ptr GLuint -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLuint -> m ()
glVertexAttrib4uiv GLuint
al

   vertexAttrib4Nv :: AttribLocation -> Ptr GLuint -> IO ()
vertexAttrib4Nv (AttribLocation GLuint
al) = GLuint -> Ptr GLuint -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLuint -> m ()
glVertexAttrib4Nuiv GLuint
al

   vertexAttrib1Iv :: AttribLocation -> Ptr GLuint -> IO ()
vertexAttrib1Iv (AttribLocation GLuint
al) = GLuint -> Ptr GLuint -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLuint -> m ()
glVertexAttribI1uiv GLuint
al
   vertexAttrib2Iv :: AttribLocation -> Ptr GLuint -> IO ()
vertexAttrib2Iv (AttribLocation GLuint
al) = GLuint -> Ptr GLuint -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLuint -> m ()
glVertexAttribI2uiv GLuint
al
   vertexAttrib3Iv :: AttribLocation -> Ptr GLuint -> IO ()
vertexAttrib3Iv (AttribLocation GLuint
al) = GLuint -> Ptr GLuint -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLuint -> m ()
glVertexAttribI3uiv GLuint
al
   vertexAttrib4Iv :: AttribLocation -> Ptr GLuint -> IO ()
vertexAttrib4Iv (AttribLocation GLuint
al) = GLuint -> Ptr GLuint -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLuint -> m ()
glVertexAttribI4uiv GLuint
al

instance VertexAttribComponent GLfloat where
   vertexAttrib1 :: AttribLocation -> GLfloat -> IO ()
vertexAttrib1 (AttribLocation GLuint
al) = GLuint -> GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> GLfloat -> m ()
glVertexAttrib1f GLuint
al
   vertexAttrib2 :: AttribLocation -> GLfloat -> GLfloat -> IO ()
vertexAttrib2 (AttribLocation GLuint
al) = GLuint -> GLfloat -> GLfloat -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLfloat -> GLfloat -> m ()
glVertexAttrib2f GLuint
al
   vertexAttrib3 :: AttribLocation -> GLfloat -> GLfloat -> GLfloat -> IO ()
vertexAttrib3 (AttribLocation GLuint
al) = GLuint -> GLfloat -> GLfloat -> GLfloat -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLfloat -> GLfloat -> GLfloat -> m ()
glVertexAttrib3f GLuint
al
   vertexAttrib4 :: AttribLocation -> GLfloat -> GLfloat -> GLfloat -> GLfloat -> IO ()
vertexAttrib4 (AttribLocation GLuint
al) = GLuint -> GLfloat -> GLfloat -> GLfloat -> GLfloat -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLfloat -> GLfloat -> GLfloat -> GLfloat -> m ()
glVertexAttrib4f GLuint
al

   vertexAttrib1v :: AttribLocation -> Ptr GLfloat -> IO ()
vertexAttrib1v (AttribLocation GLuint
al) = GLuint -> Ptr GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLfloat -> m ()
glVertexAttrib1fv GLuint
al
   vertexAttrib2v :: AttribLocation -> Ptr GLfloat -> IO ()
vertexAttrib2v (AttribLocation GLuint
al) = GLuint -> Ptr GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLfloat -> m ()
glVertexAttrib2fv GLuint
al
   vertexAttrib3v :: AttribLocation -> Ptr GLfloat -> IO ()
vertexAttrib3v (AttribLocation GLuint
al) = GLuint -> Ptr GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLfloat -> m ()
glVertexAttrib3fv GLuint
al
   vertexAttrib4v :: AttribLocation -> Ptr GLfloat -> IO ()
vertexAttrib4v (AttribLocation GLuint
al) = GLuint -> Ptr GLfloat -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLfloat -> m ()
glVertexAttrib4fv GLuint
al

   vertexAttrib4Nv :: AttribLocation -> Ptr GLfloat -> IO ()
vertexAttrib4Nv = AttribLocation -> Ptr GLfloat -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib4v

   vertexAttrib4Iv :: AttribLocation -> Ptr GLfloat -> IO ()
vertexAttrib4Iv = AttribLocation -> Ptr GLfloat -> IO ()
forall a.
(Storable a, RealFrac a) =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib4IvRealFrac

vertexAttrib4IvRealFrac :: (Storable a, RealFrac a) => AttribLocation -> Ptr a -> IO ()
vertexAttrib4IvRealFrac :: forall a.
(Storable a, RealFrac a) =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib4IvRealFrac AttribLocation
location = (a -> a -> a -> a -> IO ()) -> Ptr a -> IO ()
forall a b.
Storable a =>
(a -> a -> a -> a -> IO b) -> Ptr a -> IO b
peek4M ((a -> a -> a -> a -> IO ()) -> Ptr a -> IO ())
-> (a -> a -> a -> a -> IO ()) -> Ptr a -> IO ()
forall a b. (a -> b) -> a -> b
$ \a
x a
y a
z a
w ->
   AttribLocation -> GLint -> GLint -> GLint -> GLint -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> a -> IO ()
vertexAttrib4I AttribLocation
location (a -> GLint
forall a. RealFrac a => a -> GLint
toGLint a
x) (a -> GLint
forall a. RealFrac a => a -> GLint
toGLint a
y) (a -> GLint
forall a. RealFrac a => a -> GLint
toGLint a
z) (a -> GLint
forall a. RealFrac a => a -> GLint
toGLint a
w)

-- formula 2.6 from the OpenGL 3.1 spec
toGLint :: RealFrac a => a -> GLint
toGLint :: forall a. RealFrac a => a -> GLint
toGLint = a -> GLint
forall a b. (RealFrac a, Integral b) => a -> b
truncate (a -> GLint) -> (a -> a) -> a -> GLint
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (GLint -> a
forall a b. (Integral a, Num b) => a -> b
fromIntegral (GLint
forall a. Bounded a => a
maxBound :: GLint) a -> a -> a
forall a. Num a => a -> a -> a
*)(a -> a) -> (a -> a) -> a -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> a
clamp
   where clamp :: a -> a
clamp = a -> a -> a
forall a. Ord a => a -> a -> a
max (-a
1.0) (a -> a) -> (a -> a) -> a -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> a -> a
forall a. Ord a => a -> a -> a
min a
1.0

instance VertexAttribComponent GLdouble where
   vertexAttrib1 :: AttribLocation -> GLdouble -> IO ()
vertexAttrib1 (AttribLocation GLuint
al) = GLuint -> GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> GLdouble -> m ()
glVertexAttrib1d GLuint
al
   vertexAttrib2 :: AttribLocation -> GLdouble -> GLdouble -> IO ()
vertexAttrib2 (AttribLocation GLuint
al) = GLuint -> GLdouble -> GLdouble -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLdouble -> GLdouble -> m ()
glVertexAttrib2d GLuint
al
   vertexAttrib3 :: AttribLocation -> GLdouble -> GLdouble -> GLdouble -> IO ()
vertexAttrib3 (AttribLocation GLuint
al) = GLuint -> GLdouble -> GLdouble -> GLdouble -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLdouble -> GLdouble -> GLdouble -> m ()
glVertexAttrib3d GLuint
al
   vertexAttrib4 :: AttribLocation
-> GLdouble -> GLdouble -> GLdouble -> GLdouble -> IO ()
vertexAttrib4 (AttribLocation GLuint
al) = GLuint -> GLdouble -> GLdouble -> GLdouble -> GLdouble -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLdouble -> GLdouble -> GLdouble -> GLdouble -> m ()
glVertexAttrib4d GLuint
al

   vertexAttrib1v :: AttribLocation -> Ptr GLdouble -> IO ()
vertexAttrib1v (AttribLocation GLuint
al) = GLuint -> Ptr GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLdouble -> m ()
glVertexAttrib1dv GLuint
al
   vertexAttrib2v :: AttribLocation -> Ptr GLdouble -> IO ()
vertexAttrib2v (AttribLocation GLuint
al) = GLuint -> Ptr GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLdouble -> m ()
glVertexAttrib2dv GLuint
al
   vertexAttrib3v :: AttribLocation -> Ptr GLdouble -> IO ()
vertexAttrib3v (AttribLocation GLuint
al) = GLuint -> Ptr GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLdouble -> m ()
glVertexAttrib3dv GLuint
al
   vertexAttrib4v :: AttribLocation -> Ptr GLdouble -> IO ()
vertexAttrib4v (AttribLocation GLuint
al) = GLuint -> Ptr GLdouble -> IO ()
forall (m :: * -> *). MonadIO m => GLuint -> Ptr GLdouble -> m ()
glVertexAttrib4dv GLuint
al

   vertexAttrib4Nv :: AttribLocation -> Ptr GLdouble -> IO ()
vertexAttrib4Nv = AttribLocation -> Ptr GLdouble -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib4v

   vertexAttrib4Iv :: AttribLocation -> Ptr GLdouble -> IO ()
vertexAttrib4Iv = AttribLocation -> Ptr GLdouble -> IO ()
forall a.
(Storable a, RealFrac a) =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib4IvRealFrac

--------------------------------------------------------------------------------

class VertexAttrib a where
   vertexAttrib  :: IntegerHandling -> AttribLocation ->     a -> IO ()
   vertexAttribv :: IntegerHandling -> AttribLocation -> Ptr a -> IO ()

instance VertexAttribComponent a => VertexAttrib (Vertex1 a) where
   vertexAttrib :: IntegerHandling -> AttribLocation -> Vertex1 a -> IO ()
vertexAttrib IntegerHandling
ToFloat AttribLocation
location (Vertex1 a
i) = AttribLocation -> a -> IO ()
forall a. VertexAttribComponent a => AttribLocation -> a -> IO ()
vertexAttrib1 AttribLocation
location a
i
   vertexAttrib IntegerHandling
ToNormalizedFloat AttribLocation
location (Vertex1 a
i) = AttribLocation -> a -> IO ()
forall a. VertexAttribComponent a => AttribLocation -> a -> IO ()
vertexAttrib1N AttribLocation
location a
i
   vertexAttrib IntegerHandling
KeepIntegral AttribLocation
location (Vertex1 a
i) = AttribLocation -> a -> IO ()
forall a. VertexAttribComponent a => AttribLocation -> a -> IO ()
vertexAttrib1I AttribLocation
location a
i

   vertexAttribv :: IntegerHandling -> AttribLocation -> Ptr (Vertex1 a) -> IO ()
vertexAttribv IntegerHandling
ToFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib1v AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Vertex1 a) -> Ptr a) -> Ptr (Vertex1 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vertex1 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vertex1 b) -> Ptr b)
   vertexAttribv IntegerHandling
ToNormalizedFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib1Nv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Vertex1 a) -> Ptr a) -> Ptr (Vertex1 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vertex1 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vertex1 b) -> Ptr b)
   vertexAttribv IntegerHandling
KeepIntegral AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib1Iv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Vertex1 a) -> Ptr a) -> Ptr (Vertex1 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vertex1 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vertex1 b) -> Ptr b)

instance VertexAttribComponent a => VertexAttrib (Vertex2 a) where
   vertexAttrib :: IntegerHandling -> AttribLocation -> Vertex2 a -> IO ()
vertexAttrib IntegerHandling
ToFloat AttribLocation
location (Vertex2 a
x a
y) = AttribLocation -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> IO ()
vertexAttrib2 AttribLocation
location a
x a
y
   vertexAttrib IntegerHandling
ToNormalizedFloat AttribLocation
location (Vertex2 a
x a
y) = AttribLocation -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> IO ()
vertexAttrib2N AttribLocation
location a
x a
y
   vertexAttrib IntegerHandling
KeepIntegral AttribLocation
location (Vertex2 a
x a
y) = AttribLocation -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> IO ()
vertexAttrib2I AttribLocation
location a
x a
y

   vertexAttribv :: IntegerHandling -> AttribLocation -> Ptr (Vertex2 a) -> IO ()
vertexAttribv IntegerHandling
ToFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib2v AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Vertex2 a) -> Ptr a) -> Ptr (Vertex2 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vertex2 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vertex2 b) -> Ptr b)
   vertexAttribv IntegerHandling
ToNormalizedFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib2Nv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Vertex2 a) -> Ptr a) -> Ptr (Vertex2 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vertex2 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vertex2 b) -> Ptr b)
   vertexAttribv IntegerHandling
KeepIntegral AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib2Iv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Vertex2 a) -> Ptr a) -> Ptr (Vertex2 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vertex2 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vertex2 b) -> Ptr b)

instance VertexAttribComponent a => VertexAttrib (Vertex3 a) where
   vertexAttrib :: IntegerHandling -> AttribLocation -> Vertex3 a -> IO ()
vertexAttrib IntegerHandling
ToFloat AttribLocation
location (Vertex3 a
x a
y a
z) = AttribLocation -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> IO ()
vertexAttrib3 AttribLocation
location a
x a
y a
z
   vertexAttrib IntegerHandling
ToNormalizedFloat AttribLocation
location (Vertex3 a
x a
y a
z) = AttribLocation -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> IO ()
vertexAttrib3N AttribLocation
location a
x a
y a
z
   vertexAttrib IntegerHandling
KeepIntegral AttribLocation
location (Vertex3 a
x a
y a
z) = AttribLocation -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> IO ()
vertexAttrib3I AttribLocation
location a
x a
y a
z

   vertexAttribv :: IntegerHandling -> AttribLocation -> Ptr (Vertex3 a) -> IO ()
vertexAttribv IntegerHandling
ToFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib3v AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Vertex3 a) -> Ptr a) -> Ptr (Vertex3 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vertex3 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vertex3 b) -> Ptr b)
   vertexAttribv IntegerHandling
ToNormalizedFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib3Nv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Vertex3 a) -> Ptr a) -> Ptr (Vertex3 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vertex3 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vertex3 b) -> Ptr b)
   vertexAttribv IntegerHandling
KeepIntegral AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib3Iv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Vertex3 a) -> Ptr a) -> Ptr (Vertex3 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vertex3 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vertex3 b) -> Ptr b)

instance VertexAttribComponent a => VertexAttrib (Vertex4 a) where
   vertexAttrib :: IntegerHandling -> AttribLocation -> Vertex4 a -> IO ()
vertexAttrib IntegerHandling
ToFloat AttribLocation
location (Vertex4 a
x a
y a
z a
w) = AttribLocation -> a -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> a -> IO ()
vertexAttrib4 AttribLocation
location a
x a
y a
z a
w
   vertexAttrib IntegerHandling
ToNormalizedFloat AttribLocation
location (Vertex4 a
x a
y a
z a
w) = AttribLocation -> a -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> a -> IO ()
vertexAttrib4N AttribLocation
location a
x a
y a
z a
w
   vertexAttrib IntegerHandling
KeepIntegral AttribLocation
location (Vertex4 a
x a
y a
z a
w) = AttribLocation -> a -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> a -> IO ()
vertexAttrib4I AttribLocation
location a
x a
y a
z a
w

   vertexAttribv :: IntegerHandling -> AttribLocation -> Ptr (Vertex4 a) -> IO ()
vertexAttribv IntegerHandling
ToFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib4v AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Vertex4 a) -> Ptr a) -> Ptr (Vertex4 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vertex4 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vertex4 b) -> Ptr b)
   vertexAttribv IntegerHandling
ToNormalizedFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib4Nv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Vertex4 a) -> Ptr a) -> Ptr (Vertex4 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vertex4 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vertex4 b) -> Ptr b)
   vertexAttribv IntegerHandling
KeepIntegral AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib4Iv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Vertex4 a) -> Ptr a) -> Ptr (Vertex4 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vertex4 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vertex4 b) -> Ptr b)

instance VertexAttribComponent a => VertexAttrib (Vector1 a) where
   vertexAttrib :: IntegerHandling -> AttribLocation -> Vector1 a -> IO ()
vertexAttrib IntegerHandling
ToFloat AttribLocation
location (Vector1 a
i) = AttribLocation -> a -> IO ()
forall a. VertexAttribComponent a => AttribLocation -> a -> IO ()
vertexAttrib1 AttribLocation
location a
i
   vertexAttrib IntegerHandling
ToNormalizedFloat AttribLocation
location (Vector1 a
i) = AttribLocation -> a -> IO ()
forall a. VertexAttribComponent a => AttribLocation -> a -> IO ()
vertexAttrib1N AttribLocation
location a
i
   vertexAttrib IntegerHandling
KeepIntegral AttribLocation
location (Vector1 a
i) = AttribLocation -> a -> IO ()
forall a. VertexAttribComponent a => AttribLocation -> a -> IO ()
vertexAttrib1I AttribLocation
location a
i

   vertexAttribv :: IntegerHandling -> AttribLocation -> Ptr (Vector1 a) -> IO ()
vertexAttribv IntegerHandling
ToFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib1v AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Vector1 a) -> Ptr a) -> Ptr (Vector1 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vector1 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vector1 b) -> Ptr b)
   vertexAttribv IntegerHandling
ToNormalizedFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib1Nv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Vector1 a) -> Ptr a) -> Ptr (Vector1 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vector1 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vector1 b) -> Ptr b)
   vertexAttribv IntegerHandling
KeepIntegral AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib1Iv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Vector1 a) -> Ptr a) -> Ptr (Vector1 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vector1 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vector1 b) -> Ptr b)

instance VertexAttribComponent a => VertexAttrib (Vector2 a) where
   vertexAttrib :: IntegerHandling -> AttribLocation -> Vector2 a -> IO ()
vertexAttrib IntegerHandling
ToFloat AttribLocation
location (Vector2 a
x a
y) = AttribLocation -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> IO ()
vertexAttrib2 AttribLocation
location a
x a
y
   vertexAttrib IntegerHandling
ToNormalizedFloat AttribLocation
location (Vector2 a
x a
y) = AttribLocation -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> IO ()
vertexAttrib2N AttribLocation
location a
x a
y
   vertexAttrib IntegerHandling
KeepIntegral AttribLocation
location (Vector2 a
x a
y) = AttribLocation -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> IO ()
vertexAttrib2I AttribLocation
location a
x a
y

   vertexAttribv :: IntegerHandling -> AttribLocation -> Ptr (Vector2 a) -> IO ()
vertexAttribv IntegerHandling
ToFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib2v AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Vector2 a) -> Ptr a) -> Ptr (Vector2 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vector2 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vector2 b) -> Ptr b)
   vertexAttribv IntegerHandling
ToNormalizedFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib2Nv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Vector2 a) -> Ptr a) -> Ptr (Vector2 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vector2 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vector2 b) -> Ptr b)
   vertexAttribv IntegerHandling
KeepIntegral AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib2Iv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Vector2 a) -> Ptr a) -> Ptr (Vector2 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vector2 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vector2 b) -> Ptr b)

instance VertexAttribComponent a => VertexAttrib (Vector3 a) where
   vertexAttrib :: IntegerHandling -> AttribLocation -> Vector3 a -> IO ()
vertexAttrib IntegerHandling
ToFloat AttribLocation
location (Vector3 a
x a
y a
z) = AttribLocation -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> IO ()
vertexAttrib3 AttribLocation
location a
x a
y a
z
   vertexAttrib IntegerHandling
ToNormalizedFloat AttribLocation
location (Vector3 a
x a
y a
z) = AttribLocation -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> IO ()
vertexAttrib3N AttribLocation
location a
x a
y a
z
   vertexAttrib IntegerHandling
KeepIntegral AttribLocation
location (Vector3 a
x a
y a
z) = AttribLocation -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> IO ()
vertexAttrib3I AttribLocation
location a
x a
y a
z

   vertexAttribv :: IntegerHandling -> AttribLocation -> Ptr (Vector3 a) -> IO ()
vertexAttribv IntegerHandling
ToFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib3v AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Vector3 a) -> Ptr a) -> Ptr (Vector3 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vector3 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vector3 b) -> Ptr b)
   vertexAttribv IntegerHandling
ToNormalizedFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib3Nv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Vector3 a) -> Ptr a) -> Ptr (Vector3 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vector3 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vector3 b) -> Ptr b)
   vertexAttribv IntegerHandling
KeepIntegral AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib3Iv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Vector3 a) -> Ptr a) -> Ptr (Vector3 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vector3 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vector3 b) -> Ptr b)

instance VertexAttribComponent a => VertexAttrib (Vector4 a) where
   vertexAttrib :: IntegerHandling -> AttribLocation -> Vector4 a -> IO ()
vertexAttrib IntegerHandling
ToFloat AttribLocation
location (Vector4 a
x a
y a
z a
w) = AttribLocation -> a -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> a -> IO ()
vertexAttrib4 AttribLocation
location a
x a
y a
z a
w
   vertexAttrib IntegerHandling
ToNormalizedFloat AttribLocation
location (Vector4 a
x a
y a
z a
w) = AttribLocation -> a -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> a -> IO ()
vertexAttrib4N AttribLocation
location a
x a
y a
z a
w
   vertexAttrib IntegerHandling
KeepIntegral AttribLocation
location (Vector4 a
x a
y a
z a
w) = AttribLocation -> a -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> a -> IO ()
vertexAttrib4I AttribLocation
location a
x a
y a
z a
w

   vertexAttribv :: IntegerHandling -> AttribLocation -> Ptr (Vector4 a) -> IO ()
vertexAttribv IntegerHandling
ToFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib4v AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Vector4 a) -> Ptr a) -> Ptr (Vector4 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vector4 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vector4 b) -> Ptr b)
   vertexAttribv IntegerHandling
ToNormalizedFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib4Nv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Vector4 a) -> Ptr a) -> Ptr (Vector4 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vector4 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vector4 b) -> Ptr b)
   vertexAttribv IntegerHandling
KeepIntegral AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib4Iv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Vector4 a) -> Ptr a) -> Ptr (Vector4 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Vector4 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Vector4 b) -> Ptr b)

instance VertexAttribComponent a => VertexAttrib (TexCoord1 a) where
   vertexAttrib :: IntegerHandling -> AttribLocation -> TexCoord1 a -> IO ()
vertexAttrib IntegerHandling
ToFloat AttribLocation
location (TexCoord1 a
s) = AttribLocation -> a -> IO ()
forall a. VertexAttribComponent a => AttribLocation -> a -> IO ()
vertexAttrib1 AttribLocation
location a
s
   vertexAttrib IntegerHandling
ToNormalizedFloat AttribLocation
location (TexCoord1 a
s) = AttribLocation -> a -> IO ()
forall a. VertexAttribComponent a => AttribLocation -> a -> IO ()
vertexAttrib1N AttribLocation
location a
s
   vertexAttrib IntegerHandling
KeepIntegral AttribLocation
location (TexCoord1 a
s) = AttribLocation -> a -> IO ()
forall a. VertexAttribComponent a => AttribLocation -> a -> IO ()
vertexAttrib1I AttribLocation
location a
s

   vertexAttribv :: IntegerHandling -> AttribLocation -> Ptr (TexCoord1 a) -> IO ()
vertexAttribv IntegerHandling
ToFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib1v AttribLocation
location (Ptr a -> IO ())
-> (Ptr (TexCoord1 a) -> Ptr a) -> Ptr (TexCoord1 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (TexCoord1 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (TexCoord1 b) -> Ptr b)
   vertexAttribv IntegerHandling
ToNormalizedFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib1Nv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (TexCoord1 a) -> Ptr a) -> Ptr (TexCoord1 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (TexCoord1 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (TexCoord1 b) -> Ptr b)
   vertexAttribv IntegerHandling
KeepIntegral AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib1Iv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (TexCoord1 a) -> Ptr a) -> Ptr (TexCoord1 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (TexCoord1 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (TexCoord1 b) -> Ptr b)

instance VertexAttribComponent a => VertexAttrib (TexCoord2 a) where
   vertexAttrib :: IntegerHandling -> AttribLocation -> TexCoord2 a -> IO ()
vertexAttrib IntegerHandling
ToFloat AttribLocation
location (TexCoord2 a
s a
t) = AttribLocation -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> IO ()
vertexAttrib2 AttribLocation
location a
s a
t
   vertexAttrib IntegerHandling
ToNormalizedFloat AttribLocation
location (TexCoord2 a
s a
t) = AttribLocation -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> IO ()
vertexAttrib2N AttribLocation
location a
s a
t
   vertexAttrib IntegerHandling
KeepIntegral AttribLocation
location (TexCoord2 a
s a
t) = AttribLocation -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> IO ()
vertexAttrib2I AttribLocation
location a
s a
t

   vertexAttribv :: IntegerHandling -> AttribLocation -> Ptr (TexCoord2 a) -> IO ()
vertexAttribv IntegerHandling
ToFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib2v AttribLocation
location (Ptr a -> IO ())
-> (Ptr (TexCoord2 a) -> Ptr a) -> Ptr (TexCoord2 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (TexCoord2 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (TexCoord2 b) -> Ptr b)
   vertexAttribv IntegerHandling
ToNormalizedFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib2Nv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (TexCoord2 a) -> Ptr a) -> Ptr (TexCoord2 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (TexCoord2 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (TexCoord2 b) -> Ptr b)
   vertexAttribv IntegerHandling
KeepIntegral AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib2Iv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (TexCoord2 a) -> Ptr a) -> Ptr (TexCoord2 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (TexCoord2 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (TexCoord2 b) -> Ptr b)

instance VertexAttribComponent a => VertexAttrib (TexCoord3 a) where
   vertexAttrib :: IntegerHandling -> AttribLocation -> TexCoord3 a -> IO ()
vertexAttrib IntegerHandling
ToFloat AttribLocation
location (TexCoord3 a
s a
t a
u) = AttribLocation -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> IO ()
vertexAttrib3 AttribLocation
location a
s a
t a
u
   vertexAttrib IntegerHandling
ToNormalizedFloat AttribLocation
location (TexCoord3 a
s a
t a
u) = AttribLocation -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> IO ()
vertexAttrib3N AttribLocation
location a
s a
t a
u
   vertexAttrib IntegerHandling
KeepIntegral AttribLocation
location (TexCoord3 a
s a
t a
u) = AttribLocation -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> IO ()
vertexAttrib3I AttribLocation
location a
s a
t a
u

   vertexAttribv :: IntegerHandling -> AttribLocation -> Ptr (TexCoord3 a) -> IO ()
vertexAttribv IntegerHandling
ToFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib3v AttribLocation
location (Ptr a -> IO ())
-> (Ptr (TexCoord3 a) -> Ptr a) -> Ptr (TexCoord3 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (TexCoord3 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (TexCoord3 b) -> Ptr b)
   vertexAttribv IntegerHandling
ToNormalizedFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib3Nv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (TexCoord3 a) -> Ptr a) -> Ptr (TexCoord3 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (TexCoord3 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (TexCoord3 b) -> Ptr b)
   vertexAttribv IntegerHandling
KeepIntegral AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib3Iv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (TexCoord3 a) -> Ptr a) -> Ptr (TexCoord3 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (TexCoord3 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (TexCoord3 b) -> Ptr b)

instance VertexAttribComponent a => VertexAttrib (TexCoord4 a) where
   vertexAttrib :: IntegerHandling -> AttribLocation -> TexCoord4 a -> IO ()
vertexAttrib IntegerHandling
ToFloat AttribLocation
location (TexCoord4 a
s a
t a
u a
v) = AttribLocation -> a -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> a -> IO ()
vertexAttrib4 AttribLocation
location a
s a
t a
u a
v
   vertexAttrib IntegerHandling
ToNormalizedFloat AttribLocation
location (TexCoord4 a
s a
t a
u a
v) = AttribLocation -> a -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> a -> IO ()
vertexAttrib4N AttribLocation
location a
s a
t a
u a
v
   vertexAttrib IntegerHandling
KeepIntegral AttribLocation
location (TexCoord4 a
s a
t a
u a
v) = AttribLocation -> a -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> a -> IO ()
vertexAttrib4I AttribLocation
location a
s a
t a
u a
v

   vertexAttribv :: IntegerHandling -> AttribLocation -> Ptr (TexCoord4 a) -> IO ()
vertexAttribv IntegerHandling
ToFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib4v AttribLocation
location (Ptr a -> IO ())
-> (Ptr (TexCoord4 a) -> Ptr a) -> Ptr (TexCoord4 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (TexCoord4 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (TexCoord4 b) -> Ptr b)
   vertexAttribv IntegerHandling
ToNormalizedFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib4Nv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (TexCoord4 a) -> Ptr a) -> Ptr (TexCoord4 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (TexCoord4 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (TexCoord4 b) -> Ptr b)
   vertexAttribv IntegerHandling
KeepIntegral AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib4Iv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (TexCoord4 a) -> Ptr a) -> Ptr (TexCoord4 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (TexCoord4 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (TexCoord4 b) -> Ptr b)

instance VertexAttribComponent a => VertexAttrib (Normal3 a) where
   vertexAttrib :: IntegerHandling -> AttribLocation -> Normal3 a -> IO ()
vertexAttrib IntegerHandling
ToFloat AttribLocation
location (Normal3 a
x a
y a
z) = AttribLocation -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> IO ()
vertexAttrib3 AttribLocation
location a
x a
y a
z
   vertexAttrib IntegerHandling
ToNormalizedFloat AttribLocation
location (Normal3 a
x a
y a
z) = AttribLocation -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> IO ()
vertexAttrib3N AttribLocation
location a
x a
y a
z
   vertexAttrib IntegerHandling
KeepIntegral AttribLocation
location (Normal3 a
x a
y a
z) = AttribLocation -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> IO ()
vertexAttrib3I AttribLocation
location a
x a
y a
z

   vertexAttribv :: IntegerHandling -> AttribLocation -> Ptr (Normal3 a) -> IO ()
vertexAttribv IntegerHandling
ToFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib3v AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Normal3 a) -> Ptr a) -> Ptr (Normal3 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Normal3 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Normal3 b) -> Ptr b)
   vertexAttribv IntegerHandling
ToNormalizedFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib3Nv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Normal3 a) -> Ptr a) -> Ptr (Normal3 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Normal3 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Normal3 b) -> Ptr b)
   vertexAttribv IntegerHandling
KeepIntegral AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib3Iv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Normal3 a) -> Ptr a) -> Ptr (Normal3 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Normal3 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Normal3 b) -> Ptr b)

instance VertexAttribComponent a => VertexAttrib (FogCoord1 a) where
   vertexAttrib :: IntegerHandling -> AttribLocation -> FogCoord1 a -> IO ()
vertexAttrib IntegerHandling
ToFloat AttribLocation
location (FogCoord1 a
c) = AttribLocation -> a -> IO ()
forall a. VertexAttribComponent a => AttribLocation -> a -> IO ()
vertexAttrib1 AttribLocation
location a
c
   vertexAttrib IntegerHandling
ToNormalizedFloat AttribLocation
location (FogCoord1 a
c) = AttribLocation -> a -> IO ()
forall a. VertexAttribComponent a => AttribLocation -> a -> IO ()
vertexAttrib1N AttribLocation
location a
c
   vertexAttrib IntegerHandling
KeepIntegral AttribLocation
location (FogCoord1 a
c) = AttribLocation -> a -> IO ()
forall a. VertexAttribComponent a => AttribLocation -> a -> IO ()
vertexAttrib1I AttribLocation
location a
c

   vertexAttribv :: IntegerHandling -> AttribLocation -> Ptr (FogCoord1 a) -> IO ()
vertexAttribv IntegerHandling
ToFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib1v AttribLocation
location (Ptr a -> IO ())
-> (Ptr (FogCoord1 a) -> Ptr a) -> Ptr (FogCoord1 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (FogCoord1 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (FogCoord1 b) -> Ptr b)
   vertexAttribv IntegerHandling
ToNormalizedFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib1Nv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (FogCoord1 a) -> Ptr a) -> Ptr (FogCoord1 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (FogCoord1 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (FogCoord1 b) -> Ptr b)
   vertexAttribv IntegerHandling
KeepIntegral AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib1Iv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (FogCoord1 a) -> Ptr a) -> Ptr (FogCoord1 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (FogCoord1 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (FogCoord1 b) -> Ptr b)

instance VertexAttribComponent a => VertexAttrib (Color3 a) where
   vertexAttrib :: IntegerHandling -> AttribLocation -> Color3 a -> IO ()
vertexAttrib IntegerHandling
ToFloat AttribLocation
location (Color3 a
r a
g a
b) = AttribLocation -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> IO ()
vertexAttrib3 AttribLocation
location a
r a
g a
b
   vertexAttrib IntegerHandling
ToNormalizedFloat AttribLocation
location (Color3 a
r a
g a
b) = AttribLocation -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> IO ()
vertexAttrib3N AttribLocation
location a
r a
g a
b
   vertexAttrib IntegerHandling
KeepIntegral AttribLocation
location (Color3 a
r a
g a
b) = AttribLocation -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> IO ()
vertexAttrib3I AttribLocation
location a
r a
g a
b

   vertexAttribv :: IntegerHandling -> AttribLocation -> Ptr (Color3 a) -> IO ()
vertexAttribv IntegerHandling
ToFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib3v AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Color3 a) -> Ptr a) -> Ptr (Color3 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Color3 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Color3 b) -> Ptr b)
   vertexAttribv IntegerHandling
ToNormalizedFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib3Nv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Color3 a) -> Ptr a) -> Ptr (Color3 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Color3 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Color3 b) -> Ptr b)
   vertexAttribv IntegerHandling
KeepIntegral AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib3Iv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Color3 a) -> Ptr a) -> Ptr (Color3 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Color3 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Color3 b) -> Ptr b)

instance VertexAttribComponent a => VertexAttrib (Color4 a) where
   vertexAttrib :: IntegerHandling -> AttribLocation -> Color4 a -> IO ()
vertexAttrib IntegerHandling
ToFloat AttribLocation
location (Color4 a
r a
g a
b a
a) = AttribLocation -> a -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> a -> IO ()
vertexAttrib4 AttribLocation
location a
r a
g a
b a
a
   vertexAttrib IntegerHandling
ToNormalizedFloat AttribLocation
location (Color4 a
r a
g a
b a
a) = AttribLocation -> a -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> a -> IO ()
vertexAttrib4N AttribLocation
location a
r a
g a
b a
a
   vertexAttrib IntegerHandling
KeepIntegral AttribLocation
location (Color4 a
r a
g a
b a
a) = AttribLocation -> a -> a -> a -> a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> a -> a -> a -> a -> IO ()
vertexAttrib4I AttribLocation
location a
r a
g a
b a
a

   vertexAttribv :: IntegerHandling -> AttribLocation -> Ptr (Color4 a) -> IO ()
vertexAttribv IntegerHandling
ToFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib4v AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Color4 a) -> Ptr a) -> Ptr (Color4 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Color4 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Color4 b) -> Ptr b)
   vertexAttribv IntegerHandling
ToNormalizedFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib4Nv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Color4 a) -> Ptr a) -> Ptr (Color4 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Color4 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Color4 b) -> Ptr b)
   vertexAttribv IntegerHandling
KeepIntegral AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib4Iv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Color4 a) -> Ptr a) -> Ptr (Color4 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Color4 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Color4 b) -> Ptr b)

instance VertexAttribComponent a => VertexAttrib (Index1 a) where
   vertexAttrib :: IntegerHandling -> AttribLocation -> Index1 a -> IO ()
vertexAttrib IntegerHandling
ToFloat AttribLocation
location (Index1 a
i) = AttribLocation -> a -> IO ()
forall a. VertexAttribComponent a => AttribLocation -> a -> IO ()
vertexAttrib1 AttribLocation
location a
i
   vertexAttrib IntegerHandling
ToNormalizedFloat AttribLocation
location (Index1 a
i) = AttribLocation -> a -> IO ()
forall a. VertexAttribComponent a => AttribLocation -> a -> IO ()
vertexAttrib1N AttribLocation
location a
i
   vertexAttrib IntegerHandling
KeepIntegral AttribLocation
location (Index1 a
i) = AttribLocation -> a -> IO ()
forall a. VertexAttribComponent a => AttribLocation -> a -> IO ()
vertexAttrib1I AttribLocation
location a
i

   vertexAttribv :: IntegerHandling -> AttribLocation -> Ptr (Index1 a) -> IO ()
vertexAttribv IntegerHandling
ToFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib1v AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Index1 a) -> Ptr a) -> Ptr (Index1 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Index1 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Index1 b) -> Ptr b)
   vertexAttribv IntegerHandling
ToNormalizedFloat AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib1Nv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Index1 a) -> Ptr a) -> Ptr (Index1 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Index1 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Index1 b) -> Ptr b)
   vertexAttribv IntegerHandling
KeepIntegral AttribLocation
location = AttribLocation -> Ptr a -> IO ()
forall a.
VertexAttribComponent a =>
AttribLocation -> Ptr a -> IO ()
vertexAttrib1Iv AttribLocation
location (Ptr a -> IO ())
-> (Ptr (Index1 a) -> Ptr a) -> Ptr (Index1 a) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {b}. Ptr (Index1 b) -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr :: Ptr (Index1 b) -> Ptr b)

--------------------------------------------------------------------------------

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

maxTextureUnit :: GettableStateVar TextureUnit
maxTextureUnit :: GettableStateVar TextureUnit
maxTextureUnit =
   GettableStateVar TextureUnit -> GettableStateVar TextureUnit
forall a. IO a -> IO a
makeGettableStateVar ((GLuint -> TextureUnit) -> PName1I -> GettableStateVar TextureUnit
forall p a. GetPName1I p => (GLuint -> a) -> p -> IO a
getEnum1 (GLuint -> TextureUnit
TextureUnit (GLuint -> TextureUnit)
-> (GLuint -> GLuint) -> GLuint -> TextureUnit
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GLuint -> GLuint
forall a b. (Integral a, Num b) => a -> b
fromIntegral) PName1I
GetMaxTextureUnits)