Questions tagged [twgl.js]

twgl.js is a library for making WebGL less verbose

twgl.js is a library for making WebGL less verbose. Where as setting up WebGL to draw a lit cube might take 60 WebGL API calls twgl reduces that to around 5 API calls. twgl isn't trying to make WebGL any easier. It doesn't hide any of the complexity of using WebGL it only provides helpers to make it less verbose to use.

27 questions
4
votes
1 answer

How to draw 2D image with TWGL (WebGL helper Library)

There are dozens of examples on how draw 3d stuff with TWGL https://github.com/greggman/twgl.js/tree/master/examples. But how can I draw 2D image with it? Especially I'm interested in how to do it without using shaders?
Dmitry Kolesnikovich
  • 669
  • 2
  • 15
  • 33
3
votes
1 answer

Why am I seeing these strange clipping artifacts with WebGL?

I'm using TWGL to create an NxN plane buffer which I then use as a mesh (twgl.primitives.createPlaneBufferInfo), with extrusion on the Z axis relative to lightness values in a video. It all looks pretty good, except that I am getting strange…
baadcafe
  • 63
  • 10
2
votes
0 answers

How to enable antialias/multisampling when rendering to framebuffer with stencil buffer for webgl2?

I add samples: 4 and change gl.RGBA to gl.RGBA4 to enable antialias of first framebuffer attachment: const framebufferInfo = twgl.createFramebufferInfo(gl, [ { format: gl.RGBA4, type: gl.UNSIGNED_BYTE, min: gl.LINEAR, wrap: gl.CLAMP_TO_EDGE,…
2
votes
1 answer

Passing Array Of Vectors To Shader

Trying to pass an array of vec3s to the shader, Firefox gives me this warning: WebGL warning: uniform setter: (uniform u_colors[0]) 'values' length (4) must be a positive integer multiple of size of . Also, it only renders black, not…
fweth
  • 631
  • 6
  • 16
2
votes
1 answer

How to get Primitive Array from ES6 Promises

I am trying to load glsl scripts as strings using the ES6 Promise and Fetch APIs. I thought I had a pretty elegant solution for getting the vertex and fragment shaders and creating a new programInfo with…
2
votes
0 answers

ThreeJS ColorMaps (LookUpTables -- LUTs)

I'm converting a project from canvas2D to webgl/webgl2, and looking at using ThreeJS. One issue is using colormaps. I typically use a 256 colormap, thus colors are Uint8 Attribute arrays as indexes into a Uniform colormap: an array of 256…
backspaces
  • 3,802
  • 6
  • 34
  • 58
2
votes
1 answer

cannot ever figure out how to do texture jobs in twgl

This is the code I have for vs/fs and a simple cube that I want to put on to my canvas. some of the part is omitted for the sake of lengthiness.