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 :: MonadIO m => IO Bool -> GL () -> GL () -> m ThreadId
- stopGL :: MonadIO m => m ()
- endFrameGL :: MonadIO m => m ()
- runGL :: MonadIO m => GL () -> m ()
- withGL :: MonadIO m => GL a -> m (Future' a)
- resetDrawQueue :: MonadIO m => m ()
- glLog :: String -> IO ()
- glReadLogs :: MonadIO m => m [String]
- glLogContents :: MonadIO m => m [String]
- glFrameCount :: MonadIO m => m Int64
- glFlipping :: MonadIO m => m Bool
- framesize :: MonadIO m => Int -> Int -> m ()
- glDraw :: Typeable p => DrawMode -> Program p -> [RenderConfig] -> [UniformAssignment p] -> VertexArray p -> VertexPicker -> GL Bool
- data DrawMode
- drawPoints :: DrawMode
- drawLines :: DrawMode
- drawLineLoop :: DrawMode
- drawLineStrip :: DrawMode
- drawTriangles :: DrawMode
- triangleStrip :: DrawMode
- triangleFan :: DrawMode
- linesAdjacency :: DrawMode
- lineStripAdjacency :: DrawMode
- trianglesAdjacency :: DrawMode
- triangleStripAdjacency :: DrawMode
- type RenderConfig = GL ()
- renderTo :: RenderConfig -> 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
- module Data.Typeable
- 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. (VertexAttribute a, Typeable p) => GLName -> IO (Attrib p a)
- normalized :: Attrib p a -> Attrib p a
- divisor :: Attrib p a -> Word32 -> Attrib p a
- (&=) :: AttrStruct a p b => a -> Buffer b -> SetVertexAttr p
- data VertexArray p
- glVA :: [SetVertexAttr p] -> GL (VertexArray p)
- class VertexAttribute a
- class AttrStruct a p b | a -> p
- type SetVertexAttr p = GL ()
- constAttrib :: VertexAttribute a => Attrib p a -> a -> SetVertexAttr p
- data VertexPicker
- takeFrom :: Int32 -> Int32 -> VertexPicker
- takeFromInstanced :: Int32 -> Int32 -> Int32 -> VertexPicker
- takeFromMany :: Vector Int32 -> Vector 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 -> Vector Int32 -> Vector Int32 -> VertexPicker
- byIndices' :: VertexIx a => Buffer a -> [(Int32, Int32)] -> VertexPicker
- byRange :: VertexIx a => Buffer a -> Int32 -> Int32 -> Word32 -> Word32 -> VertexPicker
Documentation
Lifecycle
endFrameGL :: MonadIO m => m () Source
resetDrawQueue :: MonadIO m => m () Source
drawQueue may have drawcalls that use previous context, so make it sure they are removed from the queue.
glReadLogs :: MonadIO m => m [String] Source
glLogContents :: MonadIO m => m [String] Source
glFrameCount :: MonadIO m => m Int64 Source
glFlipping :: MonadIO m => m Bool Source
framesize :: MonadIO m => Int -> Int -> m () Source
GLFW.setFramebufferSizeCallback win $ Just (const framesize)
Draw Operation
Clear Screen
Draw
glDraw :: Typeable p => DrawMode -> Program p -> [RenderConfig] -> [UniformAssignment p] -> VertexArray p -> VertexPicker -> GL Bool Source
Draw Mode
linesAdjacency :: DrawMode Source
GL_EXT_geometry_shader GL_LINES_ADJACENCY_EXT
lineStripAdjacency :: DrawMode Source
GL_EXT_geometry_shader GL_LINE_STRIP_ADJACENCY_EXT
trianglesAdjacency :: DrawMode Source
GL_EXT_geometry_shader GL_TRIANGLES_ADJACENCY_EXT
triangleStripAdjacency :: DrawMode Source
GL_EXT_geometry_shader GL_TRIANGLE_STRIP_ADJACENCY_EXT
Graphics State
type RenderConfig = GL () Source
renderTo :: RenderConfig -> GL () Source
Exists for better documentation.
renderTo $ do bindFb defaultFramebuffer viewport $ V4 0 0 512 512 depthRange $ V2 0.1 10.0 begin culling cullFace hideBack
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)
module Data.Typeable
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 infix 0 Source
type UniformAssignment p = GL () Source
Vertex Attribute Array
attrib :: forall p a. (VertexAttribute a, Typeable p) => GLName -> IO (Attrib p a) Source
normalized color divisor
1 &= buffer
normalized :: Attrib p a -> Attrib p a Source
(&=) :: AttrStruct a p b => a -> Buffer b -> SetVertexAttr p infix 0 Source
data VertexArray p Source
glVA :: [SetVertexAttr p] -> GL (VertexArray p) Source
type SetVertexAttr p = GL () Source
Constant Vertex Attribute
constAttrib :: VertexAttribute a => Attrib p a -> a -> SetVertexAttr p Source
Texture
Vertex Picker
takeFrom :: Int32 -> Int32 -> VertexPicker Source
takeFromInstanced :: Int32 -> Int32 -> Int32 -> VertexPicker Source
takeFromMany :: Vector Int32 -> Vector Int32 -> VertexPicker Source
takeFromMany' :: [(Int32, Int32)] -> VertexPicker Source
byIndexInstanced :: VertexIx a => Buffer a -> Int32 -> Int32 -> Int32 -> VertexPicker Source
byIndices' :: VertexIx a => Buffer a -> [(Int32, Int32)] -> VertexPicker Source