Get started with WebGL: draw a square
netmagazine.com
netmagazine.com
I needed to add a shader to allow a mask to be used for video with an alpha channel, like this: http://jakearchibald.com/scratch/alphavid/
It's definitely helpful seeing everything laid out tutorial-style. As simple and well-written as glfx.js is, there are still some quirks of WebGL and shaders that are not at all obvious to the uninitiated JS hacker.
Don't get me wrong, I'm certain there is a segment of this community and the web-dev population at large that is thrilled by its standardization, but yikes.
That's like saying "That is the first time I've seen assembly code: what a mess."
Yes, it's a mess - it's the lowest level. You don't want to write that kind of code, normally speaking. Instead, use a nice high-level WebGL engine like CubicVR.js, three.js, etc.
The issue is that everybody does the minimum modifications needed to translate the C api into their language rather than the design the API as you would in that language.
I can't speak for WebGL, but for OpenGL there are various frameworks and such you can use but at the end of the day most people end up needing specific access to the low level guts and you just end up writing your own code to interface with it.
The best (or worst) example of this is the OpenGL context, which is basically a global (actually: thread local) variable that tells which GL context and window should be drawn to. This context then stores a bunch of other global state, such as texture bindings.
The API was (probably) designed like this because in the early 1990's it was actually a major optimization to avoid pushing parameters to the stack when calling functions several times a frame. Many graphics API's of that era did the same thing. Also there usually was only one screen with one fullscreen "window", so why not make the "display" a global variable? Now 20 years later we are stuck with this shit because it became an industry standard.
OpenGL is a pain in the ass, not only for programmers but the implementors of the API. For example, take a look at OpenGL "texture completeness" rules (textures must have consistent mipmap levels, etc). Direct3D does not have an equivalent, because the API is designed so that all textures are always complete.
Unfortunately we seem to be stuck with OpenGL for a while. There's not much interest for redesigning the API and as far as I can tell (I'm a Khronos member), no ongoing effort to do so. Direct3D is a much better API but unfortunately it supports a very limited number of platforms (none of which I actually like to use).
OpenGL did have a library called GLU that did some high level things such as quadrics (for spheres, cylinders, etc) and tesselation of polygons. It was completely written on the CPU on top of OpenGL. It worked decently for some stuff. Direct3D has also some helpers, f.ex. to do some matrix math and load 3d models.
A library like OpenGL is probably best left to be a low level API for a low level task. A high level API in this case would be a 3d engine on top of OpenGL and there are plenty of those out there.
If you want something that's easier to use, wait until game engines for JS appear. This is supposed to be low level.
With NaCL you might end up being able to use OpenCL to construct your own 3D rendering stack and use it in the browser.
You also shouldn't forget that the GPU has dedicated hardware for graphics that cannot be accessed through a GPGPU API. The framebuffer can't be manipulated with a GPGPU API. Window compositing is largely done by dedicated hardware. Some GPU's still have dedicated hardware for vertex shading. If you try to write a graphics stack with a GPGPU API, all this hardware is left unused.
There are many many frameworks that "take away the pains of core WebGL coding" and give you "as easy as jQuery" higher-level JS APIs on top of WebGL. But you get the most control over your own hardware-accelerated program if you write it directly in WebGL. It's not too complicated, only most of us aren't used the real concepts in computer graphics.
This library does a good job at abstracting all the webgl