The WebGL Computational Library
Documentation Installation Textures Texture Float32Texture Int32Texture Uint32Texture ImageTexture CanvasTexture TableTexture copyTexture Solvers Solver Copy setUniformInSolvers setUniformsInSolvers SignalPlot Plot1D Plot2D Tvsx VolumeRayCaster getColormapList Probe TextureReader ProbeRecorder IntervalCaller saveCanvas APD OrbitalCameraControl MouseListener ClickListener DoubleClickListener CtrlClickListener ShiftClickListener CommandClickListener CtrlShiftClickListener ShiftCtrlClickListener LongClickListener Storage saveToXML loadFromXML xorwow random Gui Editor glMatrix

Solver (class)

The Solver class creates a renderable WebGL program. It also sending uniform values onto the GPU for the WebGL program to be used with it. It also allows for easy set up of render targets whether it is going to be the canvas, or the texture.


The class constructor can be called as follows:

var solverInstance = new Abubu.Solver(options) ;

Where options is an object that can have the following attributes:

Instance attributes

The following attributes are accessible

Instance methods

Uniform types

The following uniform types are available:

Type name Type description GLSL type(s)
t texture sampler2D
s sampler
Other attributes: wrapS, wrapT, minFilter, magFilter.
i integer value int
i2 2D integer vector ivec2
i3 3D integer vector ivec3
i4 4D integer vector ivec4
u unsigned integer value uint
u2 2D unsigned integer vector uvec2
u3 3D unsigned integer vector uvec3
u4 4D unsigned integer vector uvec4
iv One dimensional array of integers int []
i2v One dimensional array of 2D integer vectors ivec2 []
i3v One dimensional array of 3D integer vectors ivec3 []
i4v One dimensional array of 4D integer vectors ivec4 []
uv One dimensional array of unsigned integers uint []
u2v One dimensional array of 2D unsigned integer vectors uvec2 []
u3v One dimensional array of 3D unsigned integer vectors uvec3 []
u4v One dimensional array of 4D integer vectors uvec4 []
f float value float
v2 2D float vector vec2
v3 3D float vector vec3
v4 4D float vector vec4
fv One dimensional array of float values float []
v2v One dimensional array of 2D float vectors vec2 []
v3v One dimensional array of 3D float vectors vec3 []
v4v One dimensional array of 4D float vectors vec4 []
mat2 or mat2x2 2x2 float matrix mat2 or mat2x2
mat3 or mat3x3 3x3 float matrix mat3 or mat3x3
mat4 or mat4x4 4x4 float matrix mat4 or mat4x4
mat2x3 2x3 float matrix mat2x3
mat2x4 2x4 float matrix mat2x4
mat3x2 3x2 float matrix mat3x2
mat3x4 3x4 float matrix mat3x4
mat4x3 4x3 float matrix mat4x3
mat4x2 4x2 float matrix mat4x2
Note: Boolean types of `bool`, `bvec2`, `bvec3`, `bvec4` can be sent either as integer, unsigned integers, or float counter parts. If the values are zero, the boolean values will be initialized to `false` otherwise they will be initialized to `true`.

The values of integer arrays should be of type Int32Array JavaScript with appropriate length so that the memory field matches the memory fields in the shader. Similarly, unsigned arrays are initialized with Uint32Array, and float arrays by Float32Array JavaScript arrays.


For more examples on setting up solvers and how they can be used, checkout the examples in the Tutorials section. Various examples show you how to setup geometries, shaders and uniforms, and render targets.