Low-level bindings for WebGL, WebGL2, and all of the approved/ratified extensions.
This module follows the WebGL spec pretty closely, although there are a few differences worth pointing out.
- Instead of a single
getExtension
function that returns a mystery object, each extension provides its owngetExtension{$EXTENSION_NAME}
function. - All of the
GLenum
constants are top-level values instead of class constants. The names have been prefixed withgl_
. The core WebGL enums are in the appropriateEnums
module, and any extension-specific enums are defined in that extension's module. WebGLRenderingContext
andWebGL2RenderingContext
have been implemented as type-classes instead of distinct interfaces. There are a lot of functions which changed between WebGL1 and WebGL2; this way you can still use the WebGL1 versions with a WebGL2 context.- WebGL makes pretty heavy use of multiple dispatch, with functions like
bufferData
,readPixels
, andtexImage2D
. I've provided renamed versions for overlapping function names; each one contains the original idl source in the doc comment so you can easily find the original definition in the WebGL spec. - There are a lot of functions (like
getParameter
,getBufferParameter
, etc) that return different types based on the provided arguments. I've provided a different version (getParameterBoolean
,getParameterInt
...) for each possible return type. The comments for each function will list which combinations of arguments should be used for that version. These functions will throw an exception when the value returned isn't of the expected type.
bower install purescript-webgl2-raw
Module documentation is published on Pursuit.