Copyright | (c) capsjac 2014 |
---|---|
License | LGPL-3 (see the file LICENSE) |
Safe Haskell | None |
Language | Haskell2010 |
The neat and easy to use wrapper for OpenGL EmbedSystems (ES). The wrapper is optimised for mobile and have small footprint. Assuming OpenGL ES 2.0 or any later version, however, also works with OpenGL 4.1/4.3+ on desktop.
- type GL = IO
- forkGL :: IO Bool -> GL () -> GL () -> IO ThreadId
- stopGL :: IO ()
- endFrameGL :: IO ()
- runGL :: GL () -> IO ()
- withGL :: GL a -> IO (Future' a)
- resetDrawQueue :: IO ()
- glLog :: String -> IO ()
- glReadLogs :: IO [String]
- glLogContents :: IO [String]
- flushCommandQ :: IO ()
- finishCommands :: IO ()
- clear :: [GraphicsState] -> ClearBufferMask -> GL ()
- data ClearBufferMask
- depthBuffer :: ClearBufferMask
- stencilBuffer :: ClearBufferMask
- colorBuffer :: ClearBufferMask
- glDraw :: Typeable p => DrawMode -> Program p -> [GraphicsState] -> [UniformAssignment p] -> VertexArray p -> VertexPicker -> GL Bool
- data DrawMode
- drawPoints :: DrawMode
- drawLines :: DrawMode
- drawLineLoop :: DrawMode
- drawLineStrip :: DrawMode
- drawTriangles :: DrawMode
- triangleStrip :: DrawMode
- triangleFan :: DrawMode
- type GraphicsState = GL ()
- data Shader
- vertexShader :: GLName -> ByteString -> Shader
- fragmentShader :: GLName -> ByteString -> Shader
- pixelShader :: GLName -> ByteString -> Shader
- computeShader :: GLName -> ByteString -> Shader
- geometryShader :: GLName -> ByteString -> Shader
- tessellationEvalS :: GLName -> ByteString -> Shader
- tessellationCtrlS :: GLName -> ByteString -> Shader
- data Program p
- data TransformFeedback
- type ProgramBinary = ByteString
- glCompile :: Typeable p => TransformFeedback -> [Shader] -> (Program p -> Int -> String -> Maybe ProgramBinary -> GL ()) -> GL (Progress [String] (Program p))
- glValidate :: Program p -> GL String
- data Uniform p a
- uniform :: forall p a. (UnifVal a, Typeable p) => GLName -> IO (Uniform p a)
- ($=) :: UnifVal a => Uniform p a -> a -> UniformAssignment p
- class UnifVal a
- type UniformAssignment p = GL ()
- data Attrib p a
- attrib :: forall p a. (ShaderAttribute a, Typeable p) => GLName -> IO (Attrib p a)
- normalized :: Attrib p a -> Attrib p a
- divisor :: Attrib p a -> Word32 -> Attrib p a
- (&=) :: AttrStruct b a p => a -> Buffer b -> SetVertexAttr p
- data VertexArray p
- glVA :: [SetVertexAttr p] -> GL (VertexArray p)
- class ShaderAttribute a
- class Storable b => AttrStruct b a p | a -> p
- type SetVertexAttr p = GL ()
- constAttrib :: ShaderAttribute a => Attrib p a -> a -> SetVertexAttr p
- data VertexPicker
- takeFrom :: Int32 -> Int32 -> VertexPicker
- takeFromInstanced :: Int32 -> Int32 -> Int32 -> VertexPicker
- takeFromMany :: [(Int32, Int32)] -> VertexPicker
- class VertexIx a
- byIndex :: VertexIx a => Buffer a -> Int32 -> Int32 -> VertexPicker
- byIndexInstanced :: VertexIx a => Buffer a -> Int32 -> Int32 -> Int32 -> VertexPicker
- byIndices :: VertexIx a => Buffer a -> [(Int32, Int32)] -> VertexPicker
- byIndexLimited :: VertexIx a => Buffer a -> Int32 -> Int32 -> Word32 -> Word32 -> VertexPicker
- drawCallSequence :: [VertexPicker] -> VertexPicker
Documentation
Lifecycle
endFrameGL :: IO () Source
resetDrawQueue :: IO () Source
drawQueue may have drawcalls that use previous context, so make it sure they are removed from the queue.
glReadLogs :: IO [String] Source
glLogContents :: IO [String] Source
flushCommandQ :: IO () Source
finishCommands :: IO () Source
Draw Operation
Clear Screen
clear :: [GraphicsState] -> ClearBufferMask -> GL () Source
clear [] colorBuffer clear [bindFramebuffer buf] (colorBuffer+depthBuffer)
Draw
glDraw :: Typeable p => DrawMode -> Program p -> [GraphicsState] -> [UniformAssignment p] -> VertexArray p -> VertexPicker -> GL Bool Source
Draw Mode
Graphics State
type GraphicsState = GL () Source
Programmable Shader
vertexShader :: GLName -> ByteString -> Shader Source
fragmentShader :: GLName -> ByteString -> Shader Source
pixelShader :: GLName -> ByteString -> Shader Source
Same as fragmentShader
computeShader :: GLName -> ByteString -> Shader Source
Compute shader requires ES3.1+
geometryShader :: GLName -> ByteString -> Shader Source
Geometry shader requires GL_EXT_geometry_shader (ES3.1)
tessellationEvalS :: GLName -> ByteString -> Shader Source
Tessellation Shader requires GL_EXT_tessellation_shader (ES3.1)
tessellationCtrlS :: GLName -> ByteString -> Shader Source
Tessellation Shader requires GL_EXT_tessellation_shader (ES3.1)
data TransformFeedback Source
type ProgramBinary = ByteString Source
glCompile :: Typeable p => TransformFeedback -> [Shader] -> (Program p -> Int -> String -> Maybe ProgramBinary -> GL ()) -> GL (Progress [String] (Program p)) Source
glValidate :: Program p -> GL String Source
glValidateProgram checks to see whether the executables contained in program can execute given the current OpenGL state.
Uniform Variable
($=) :: UnifVal a => Uniform p a -> a -> UniformAssignment p Source
type UniformAssignment p = GL () Source
Vertex Attribute Array
AttrStruct Float (Attrib p Float) p | |
AttrStruct Word8 (Attrib p Float) p | |
AttrStruct Vec4 (Attrib p Vec4) p | |
AttrStruct Vec3 (Attrib p Vec3) p | |
AttrStruct Vec2 (Attrib p Vec2) p | |
AttrStruct (V2 Word8) (Attrib p Vec2) p | |
AttrStruct (V3 Word8) (Attrib p Vec3) p | |
AttrStruct (V4 Word8) (Attrib p Vec4) p | |
Show (Attrib p a) |
normalized :: Attrib p a -> Attrib p a Source
(&=) :: AttrStruct b a p => a -> Buffer b -> SetVertexAttr p Source
data VertexArray p Source
glVA :: [SetVertexAttr p] -> GL (VertexArray p) Source
class ShaderAttribute a Source
class Storable b => AttrStruct b a p | a -> p Source
AttrStruct Float (Attrib p Float) p | |
AttrStruct Word8 (Attrib p Float) p | |
AttrStruct Vec4 (Attrib p Vec4) p | |
AttrStruct Vec3 (Attrib p Vec3) p | |
AttrStruct Vec2 (Attrib p Vec2) p | |
AttrStruct (V2 Word8) (Attrib p Vec2) p | |
AttrStruct (V3 Word8) (Attrib p Vec3) p | |
AttrStruct (V4 Word8) (Attrib p Vec4) p |
type SetVertexAttr p = GL () Source
Constant Vertex Attribute
constAttrib :: ShaderAttribute a => Attrib p a -> a -> SetVertexAttr p Source
Texture
Vertex Picker
data VertexPicker Source
takeFrom :: Int32 -> Int32 -> VertexPicker Source
takeFromInstanced :: Int32 -> Int32 -> Int32 -> VertexPicker Source
takeFromMany :: [(Int32, Int32)] -> VertexPicker Source
byIndexInstanced :: VertexIx a => Buffer a -> Int32 -> Int32 -> Int32 -> VertexPicker Source
byIndexLimited :: VertexIx a => Buffer a -> Int32 -> Int32 -> Word32 -> Word32 -> VertexPicker Source