opengles-0.8.3: Functional interface for OpenGL 4.1+ and OpenGL ES 2.0+

Copyright(c) capsjac 2014
LicenseLGPL-3 (see the file LICENSE)
Safe HaskellNone
LanguageHaskell2010

Graphics.OpenGLES.Core

Contents

Description

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.

Synopsis

Documentation

type GL = IO Source

IO actions run in GL thread.

Lifecycle

forkGL :: MonadIO m => IO Bool -> GL () -> GL () -> m ThreadId Source

stopGL :: MonadIO m => m () Source

runGL :: MonadIO m => GL () -> m () Source

withGL :: MonadIO m => GL a -> m (Future' a) Source

resetDrawQueue :: MonadIO m => m () Source

drawQueue may have drawcalls that use previous context, so make it sure they are removed from the queue.

framesize :: MonadIO m => Int -> Int -> m () Source

GLFW.setFramebufferSizeCallback win $ Just (const framesize)

Draw Operation

Clear Screen

Draw

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

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

data Shader Source

Instances

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 Program p Source

Instances

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

data Uniform p a Source

uniform :: forall p a. (UnifVal a, Typeable p) => GLName -> IO (Uniform p a) Source

($=) :: UnifVal a => Uniform p a -> a -> UniformAssignment p infix 0 Source

class UnifVal a Source

Minimal complete definition

glUniform

Vertex Attribute Array

data Attrib p a Source

Instances

attrib :: forall p a. (VertexAttribute a, Typeable p) => GLName -> IO (Attrib p a) Source

normalized color divisor 1 &= buffer

divisor :: Attrib p a -> Word32 -> Attrib p a Source

(&=) :: AttrStruct a p b => a -> Buffer b -> SetVertexAttr p infix 0 Source

class VertexAttribute a Source

GLSL vertex attribute type

Minimal complete definition

glVertexAttrib

class AttrStruct a p b | a -> p Source

A set of VertexAttributes packed in a Buffer

Minimal complete definition

glVertexBuffer

type SetVertexAttr p = GL () Source

Constant Vertex Attribute

Texture

Vertex Picker

class VertexIx a Source

Minimal complete definition

vxix