vect-opengl-0.4.6: OpenGL support for the `vect' low-dimensional linear algebra library.Source codeContentsIndex
Data.Vect.Double.OpenGL
Description
OpenGL support, including Vertex, TexCoord, etc instances for Vec2, Vec3 and Vec4.
Synopsis
type GLflt = GLdouble
glflt :: Double -> GLflt
unflt :: GLflt -> Double
class ToOpenGLMatrix m where
makeGLMatrix :: m -> IO (GLmatrix GLflt)
class FromOpenGLMatrix m where
peekGLMatrix :: GLmatrix GLflt -> IO m
setMatrix :: ToOpenGLMatrix m => Maybe MatrixMode -> m -> IO ()
getMatrix :: FromOpenGLMatrix m => Maybe MatrixMode -> IO m
matrix :: (ToOpenGLMatrix m, FromOpenGLMatrix m) => Maybe MatrixMode -> StateVar m
currentMatrix :: (ToOpenGLMatrix m, FromOpenGLMatrix m) => StateVar m
multMatrix :: ToOpenGLMatrix m => m -> IO ()
radianToDegrees :: RealFrac a => a -> a
degreesToRadian :: Floating a => a -> a
glRotate :: Double -> Vec3 -> IO ()
glTranslate :: Vec3 -> IO ()
glScale3 :: Vec3 -> IO ()
glScale :: Double -> IO ()
orthoMatrix :: (Double, Double) -> (Double, Double) -> (Double, Double) -> Mat4
orthoMatrix2 :: Vec3 -> Vec3 -> Mat4
frustumMatrix :: (Double, Double) -> (Double, Double) -> (Double, Double) -> Mat4
frustumMatrix2 :: Vec3 -> Vec3 -> Mat4
inverseFrustumMatrix :: (Double, Double) -> (Double, Double) -> (Double, Double) -> Mat4
class VertexAttrib' a where
vertexAttrib :: AttribLocation -> a -> IO ()
Documentation
type GLflt = GLdoubleSource
glflt :: Double -> GLfltSource
unflt :: GLflt -> DoubleSource
class ToOpenGLMatrix m whereSource

There should be a big warning here about the different conventions, hidden transpositions, and all the confusion this will inevitably cause...

As it stands,

 glRotate t1 axis1 >> glRotate t2 axis2 >> glRotate t3 axis3

has the same result as

 multMatrix (rotMatrixProj4 t3 axis3 .*. rotMatrixProj4 t2 axis2 .*. rotMatrixProj4 t1 axis1)

because at the interface of OpenGL and this library there is a transposition to compensate for the different conventions. (This transposition is implicit in the code, because the way the matrices are stored in the memory is also different: OpenGL stores them column-major, and we store them row-major).

Methods
makeGLMatrix :: m -> IO (GLmatrix GLflt)Source
show/hide Instances
class FromOpenGLMatrix m whereSource
Methods
peekGLMatrix :: GLmatrix GLflt -> IO mSource
show/hide Instances
setMatrix :: ToOpenGLMatrix m => Maybe MatrixMode -> m -> IO ()Source
getMatrix :: FromOpenGLMatrix m => Maybe MatrixMode -> IO mSource
matrix :: (ToOpenGLMatrix m, FromOpenGLMatrix m) => Maybe MatrixMode -> StateVar mSource
currentMatrix :: (ToOpenGLMatrix m, FromOpenGLMatrix m) => StateVar mSource
multMatrix :: ToOpenGLMatrix m => m -> IO ()Source
radianToDegrees :: RealFrac a => a -> aSource
degreesToRadian :: Floating a => a -> aSource
glRotate :: Double -> Vec3 -> IO ()Source
The angle is in radians. (WARNING: OpenGL uses degrees!)
glTranslate :: Vec3 -> IO ()Source
glScale3 :: Vec3 -> IO ()Source
glScale :: Double -> IO ()Source
orthoMatrixSource
:: (Double, Double)(left,right)
-> (Double, Double)(bottom,top)
-> (Double, Double)(near,far)
-> Mat4
"Orthogonal projecton" matrix, a la OpenGL (the corresponding functionality is removed in OpenGL 3.1)
orthoMatrix2Source
:: Vec3(left,top,near)
-> Vec3(right,bottom,far)
-> Mat4
The same as orthoMatrix, but with a different parametrization.
frustumMatrixSource
:: (Double, Double)(left,right)
-> (Double, Double)(bottom,top)
-> (Double, Double)(near,far)
-> Mat4
"Perspective projecton" matrix, a la OpenGL (the corresponding functionality is removed in OpenGL 3.1).
frustumMatrix2Source
:: Vec3(left,top,near)
-> Vec3(right,bottom,far)
-> Mat4
The same as frustumMatrix, but with a different parametrization.
inverseFrustumMatrixSource
:: (Double, Double)(left,right)
-> (Double, Double)(bottom,top)
-> (Double, Double)(near,far)
-> Mat4
Inverse of frustumMatrix.
class VertexAttrib' a whereSource
Methods
vertexAttrib :: AttribLocation -> a -> IO ()Source
show/hide Instances
Produced by Haddock version 2.4.1