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
getExtensionfunction that returns a mystery object, each extension provides its own
- All of the
GLenumconstants are top-level values instead of class constants. The names have been prefixed with
gl_. The core WebGL enums are in the appropriate
Enumsmodule, and any extension-specific enums are defined in that extension's module.
WebGL2RenderingContexthave 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
texImage2D. 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
getBufferParameter, etc) that return different types based on the provided arguments. I've provided a different version (
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.