gl
WebGL, 2D/3D graphics, shaders.
Load with: use gl
Quick example
use gl
result = glnew("hello", "value")
prn(result)
Functions
WebGL context
glnew(canvas_id, clear_color)
Performs the operation. Takes canvas_id, clear_color.
glvie(ctx, x, y, w, h)
Performs the operation. Takes ctx, x, y, w, h.
glclr(ctx, r, g, b, a)
Performs the operation. Takes ctx, r, g, b, a.
glclr1(ctx, mask)
Performs the operation. Takes ctx, mask.
Shaders
glshd(ctx, ty, src)
Performs the operation. Takes ctx, ty, src.
glvsh(ctx, src)
Performs the operation. Takes ctx, src.
glfsh(ctx, src)
Performs the operation. Takes ctx, src.
glpro(ctx, vs, fs)
Performs the operation. Takes ctx, vs, fs.
gluse(ctx, prog)
Sets a value. Takes ctx, prog.
glget(ctx, nm)
Performs the operation. Takes ctx, nm.
glset(ctx, nm, prog)
Performs the operation. Takes ctx, nm, prog.
Uniforms
gluni(prog, name)
Performs the operation. Takes prog, name.
gluni1(loc, v)
Performs the operation. Takes loc, v.
gluni2(loc, v0, v1)
Performs the operation. Takes loc, v0, v1.
gluni3(loc, v0, v1, v2)
Performs the operation. Takes loc, v0, v1, v2.
gluni4(loc, v0, v1, v2, v3)
Performs the operation. Takes loc, v0, v1, v2, v3.
gluni5(loc, v)
Performs the operation. Takes loc, v.
gluni6(loc, tr, m)
Performs the operation. Takes loc, tr, m.
Attributes
glatt(prog, nm)
Performs the operation. Takes prog, nm.
glena(loc)
Performs the operation. Takes loc.
gldis(loc)
Returns true/false based on a condition. Takes loc.
glatt1(loc, sz, ty, n, st, off)
Performs the operation. Takes loc, sz, ty, n, st, off.
Buffers
glbuf(ctx, tgt, dat, usg)
Performs the operation. Takes ctx, tgt, dat, usg.
glabu(ctx, dat, usg)
Performs the operation. Takes ctx, dat, usg.
glebu(ctx, dat, usg)
Performs the operation. Takes ctx, dat, usg.
glbin(ctx, tgt, buf)
Initialises. Takes ctx, tgt, buf.
Textures
gltex(ctx, tgt)
Executes. Takes ctx, tgt.
gltex1(ctx)
Performs the operation. Takes ctx.
gltex2(ctx, tgt, lvl, fmt, w, h, bord, fmt, ty, dat)
Performs the operation. Takes ctx, tgt, lvl, fmt, w, h, bord, fmt, ty, dat.
gltex3(ctx, tgt, pname, par)
Performs the operation. Takes ctx, tgt, pname, par.
glact(ctx, unit)
Performs the operation. Takes ctx, unit.
Drawing
gldra(ctx, mode, first, ct)
Performs the operation. Takes ctx, mode, first, ct.
gldra1(ctx, mode, ct, ty, off)
Performs the operation. Takes ctx, mode, ct, ty, off.
glen(cap)
Encodes. Takes cap.
gldis1(cap)
Performs the operation. Takes cap.
glble(sf, df)
Performs the operation. Takes sf, df.
gldep(cb)
Performs the operation. Takes cb.
glcul(mode)
Performs the operation. Takes mode.
Matrices
glm4()
Performs the operation.
glm4i()
Performs the operation.
glm4t(m, x, y, z)
Performs the operation. Takes m, x, y, z.
glm4s(m, x, y, z)
Performs the operation. Takes m, x, y, z.
glm4r(m, ang, x, y, z)
Performs the operation. Takes m, ang, x, y, z.
glm4p(fov, asp, near, far)
Performs the operation. Takes fov, asp, near, far.
glm4l(eye, ctr, up)
Performs the operation. Takes eye, ctr, up.
glm4m(a, b)
Performs the operation. Takes a, b.
2D Drawing utilities
glrec(ctx, x, y, w, h, col)
Performs the operation. Takes ctx, x, y, w, h, col.
glmkp(ctx)
Performs the operation. Takes ctx.
3D Utilities
glmsh(vtx, idx, n, uvs)
Performs the operation. Takes vtx, idx, n, uvs.
glmsh1(ctx, m)
Performs the operation. Takes ctx, m.
glmsh2(ctx, m, prog)
Performs the operation. Takes ctx, m, prog.
Framebuffers
glfbo(ctx, width, height)
Performs the operation. Takes ctx, width, height.
Animation loop
glloo(ctx, cb)
Performs the operation. Takes ctx, cb.
glsto(ctx)
Converts to another format. Takes ctx.
Notes
- OpenGL wrappers for native graphics.