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?
How to draw 2D image with TWGL (WebGL helper Library)
2.7k views Asked by Dmitry Kolesnikovich At
1
TWGL's only point is to make WebGL less verbose but WebGL basically only does 1 thing and that is draw stuff with shaders you provide. So you really can't do anything in TWGL without shaders just like you can't do anything in WebGL without shaders.
If you don't want the write any shaders then you need to use a higher level 3D library like three.js or pixi.js or p5.js or even something like Unity3D as they supply the shaders for you.
Otherwise here's some code that basically implements canvas 2d's
drawImagefunction in WebGL using TWGLFor a more detailed explanation see this article on making a WebGL clone of
drawImagefrom 2D canvas and this article on implementing a matrix stack like 2D canvas.