Module Documentation
June 14, 2015 ยท View on GitHub
Module Graphics.WebGL
runWebgl
runWebgl :: forall eff a. WebGL a -> Raw.WebGLContext -> Eff (canvas :: Canvas | eff) (Either WebGLError a)
runWebglWithShaders
runWebglWithShaders :: forall eff attrs uniforms a. (WebGLProgram -> Object attrs -> Object uniforms -> WebGL a) -> WebGLContext -> String -> String -> Eff (canvas :: Canvas | eff) (Either WebGLError a)
debug
debug :: WebGL Unit
Module Graphics.WebGL.Context
defaultWebglContextAttrs
defaultWebglContextAttrs :: WebGLContextAttributes
getWebglContextWithAttrs
getWebglContextWithAttrs :: forall eff. CanvasElement -> WebGLContextAttributes -> Eff (canvas :: Canvas | eff) (Maybe WebGLContext)
getWebglContext
getWebglContext :: forall eff. CanvasElement -> Eff (canvas :: Canvas | eff) (Maybe WebGLContext)
canvasElement
canvasElement :: WebGL CanvasElement
drawingBufferHeight
drawingBufferHeight :: WebGL Number
drawingBufferWidth
drawingBufferWidth :: WebGL Number
Module Graphics.WebGL.Methods
attachShader
attachShader :: WebGLProgram -> WebGLShader -> WebGL Unit
bindBuffer
bindBuffer :: ArrayBufferType -> WebGLBuffer -> WebGL Unit
bufferData
bufferData :: ArrayBufferType -> BufferData -> BufferUsage -> WebGL Unit
clear
clear :: BufferType -> WebGL Unit
clearColor
clearColor :: Number -> Number -> Number -> Number -> WebGL Unit
compileShader
compileShader :: WebGLShader -> WebGL Unit
createBuffer
createBuffer :: WebGL WebGLBuffer
createProgram
createProgram :: WebGL WebGLProgram
createShader
createShader :: ShaderType -> WebGL WebGLShader
drawArrays
drawArrays :: DrawMode -> Number -> Number -> WebGL Unit
enableVertexAttribArray
enableVertexAttribArray :: forall a. Attribute a -> WebGL Unit
getError
getError :: WebGL Number
getProgramParameter
getProgramParameter :: forall a. WebGLProgram -> ProgramParam -> WebGL a
isContextLost
isContextLost :: WebGL Boolean
linkProgram
linkProgram :: WebGLProgram -> WebGL Unit
shaderSource
shaderSource :: WebGLShader -> String -> WebGL Unit
uniform1f
uniform1f :: forall u. Uniform u -> Number -> WebGL Unit
uniform1fv
uniform1fv :: forall u. Uniform u -> Float32Array -> WebGL Unit
uniform2f
uniform2f :: forall u. Uniform u -> Number -> Number -> WebGL Unit
uniform2fv
uniform2fv :: forall u. Uniform u -> Float32Array -> WebGL Unit
uniform3f
uniform3f :: forall u. Uniform u -> Number -> Number -> Number -> WebGL Unit
uniform3fv
uniform3fv :: forall u. Uniform u -> Float32Array -> WebGL Unit
uniform4f
uniform4f :: forall u. Uniform u -> Number -> Number -> Number -> Number -> WebGL Unit
uniform4fv
uniform4fv :: forall u. Uniform u -> Float32Array -> WebGL Unit
useProgram
useProgram :: WebGLProgram -> WebGL Unit
vertexAttrib1f
vertexAttrib1f :: forall a. Attribute a -> Number -> WebGL Unit
vertexAttrib1fv
vertexAttrib1fv :: forall a. Attribute a -> Float32Array -> WebGL Unit
vertexAttrib2f
vertexAttrib2f :: forall a. Attribute a -> Number -> Number -> WebGL Unit
vertexAttrib2fv
vertexAttrib2fv :: forall a. Attribute a -> Float32Array -> WebGL Unit
vertexAttrib3f
vertexAttrib3f :: forall a. Attribute a -> Number -> Number -> Number -> WebGL Unit
vertexAttrib3fv
vertexAttrib3fv :: forall a. Attribute a -> Float32Array -> WebGL Unit
vertexAttrib4f
vertexAttrib4f :: forall a. Attribute a -> Number -> Number -> Number -> Number -> WebGL Unit
vertexAttrib4fv
vertexAttrib4fv :: forall a. Attribute a -> Float32Array -> WebGL Unit
vertexAttribPointer
vertexAttribPointer :: forall a. Attribute a -> Number -> DataType -> Boolean -> Number -> Number -> WebGL Unit
Module Graphics.WebGL.Shader
setVertAttrNumber
instance setVertAttrNumber :: SetVertAttr Number
setVertAttrVec2
instance setVertAttrVec2 :: SetVertAttr Vec2
setVertAttrVec3
instance setVertAttrVec3 :: SetVertAttr Vec3
setVertAttrVec4
instance setVertAttrVec4 :: SetVertAttr Vec4
setUniformNumber
instance setUniformNumber :: SetUniform Number
setUniformVec2
instance setUniformVec2 :: SetUniform Vec2
setUniformVec3
instance setUniformVec3 :: SetUniform Vec3
setUniformVec4
instance setUniformVec4 :: SetUniform Vec4
addShaderToProgram
addShaderToProgram :: WebGLProgram -> ShaderType -> String -> WebGL Unit
compileShadersIntoProgram
compileShadersIntoProgram :: String -> String -> WebGL WebGLProgram
getAttrBindings
getAttrBindings :: forall bindings. WebGLProgram -> WebGL (Object bindings)
getUniformBindings
getUniformBindings :: forall bindings. WebGLProgram -> WebGL (Object bindings)
Module Graphics.WebGL.Types
WebGLT
type WebGLT eff a = ReaderT Raw.WebGLContext (ErrorT WebGLError eff) a
WebGL
type WebGL a = forall eff. WebGLT (Eff (canvas :: Canvas | eff)) a
WebGLError
data WebGLError
= ContextLost
| ErrorCode ErrorCode
| NullValue String
| ShaderError String
showWebGLError
instance showWebGLError :: Show WebGLError
WebGLBuffer
type WebGLBuffer = Raw.WebGLBuffer
WebGLContext
type WebGLContext = Raw.WebGLContext
WebGLContextAttributes
type WebGLContextAttributes = Raw.WebGLContextAttributes
WebGLProgram
type WebGLProgram = Raw.WebGLProgram
WebGLShader
type WebGLShader = Raw.WebGLShader
WebGLUniformLocation
type WebGLUniformLocation = Raw.WebGLUniformLocation
Vec2
data Vec2
= Vec2 Number Number
Vec3
data Vec3
= Vec3 Number Number Number
Vec4
data Vec4
= Vec4 Number Number Number Number
Mat2
data Mat2
= Mat2 Number Number Number Number
Mat3
data Mat3
= Mat3 Number Number Number Number Number Number Number Number Number
Mat4
data Mat4
= Mat4 Number Number Number Number Number Number Number Number Number Number Number Number Number Number Number Number
Attribute
newtype Attribute a
= Attribute Number
Uniform
newtype Uniform a
= Uniform WebGLUniformLocation
ToWebGLEnum
class ToWebGLEnum a where
toWebglEnum :: a -> Number
FromWebGLEnum
class FromWebGLEnum a where
fromWebglEnum :: Number -> a
ArrayBufferType
data ArrayBufferType
= ArrayBuffer
| ElementArrayBuffer
toWebglEnumArrayBufferType
instance toWebglEnumArrayBufferType :: ToWebGLEnum ArrayBufferType
BufferType
data BufferType
= DepthBuffer
| ColorBuffer
| StencilBuffer
toWebglEnumBufferType
instance toWebglEnumBufferType :: ToWebGLEnum BufferType
BufferUsage
data BufferUsage
= DynamicDraw
| StaticDraw
| StreamDraw
toWebglEnumBufferUsage
instance toWebglEnumBufferUsage :: ToWebGLEnum BufferUsage
DataType
data DataType
= Byte
| UnsignedByte
| Short
| UnsignedShort
| Int
| UnsignedInt
| Float
toWebglEnumDataType
instance toWebglEnumDataType :: ToWebGLEnum DataType
DrawMode
data DrawMode
= Points
| Lines
| LineLoop
| LineStrip
| Triangles
| TriangleStrip
| TriangleFan
toWebglEnumDrawMode
instance toWebglEnumDrawMode :: ToWebGLEnum DrawMode
ErrorCode
data ErrorCode
= NoError
| InvalidEnum
| InvalidValue
| InvalidOperation
| OutOfMemory
| UnknownError
fromWebglEnumErrorCode
instance fromWebglEnumErrorCode :: FromWebGLEnum ErrorCode
showErrorCode
instance showErrorCode :: Show ErrorCode
ProgramParam
data ProgramParam
= DeleteStatus
| LinkStatus
| ValidateStatus
| AttachedShaders
| ActiveAttrs
| ActiveUniforms
toWebglEnumProgramParam
instance toWebglEnumProgramParam :: ToWebGLEnum ProgramParam
ShaderType
data ShaderType
= FragmentShader
| VertexShader
toWebglEnumShader
instance toWebglEnumShader :: ToWebGLEnum ShaderType
BufferData
data BufferData
= DataSize Number
| DataSource Float32Array
Module Graphics.WebGL.Unsafe
unsafeCoerce
unsafeCoerce :: forall a b. a -> b