

Get started with WebGL: draw a square - tilt
http://www.netmagazine.com/tutorials/get-started-webgl-draw-square

======
nkassis
Also don't miss <http://www.learningwebgl.com> for more advanced tutorials.

------
mikepurvis
I cut my teeth on WebGL shaders by digging into the source of glfx.js:
<http://evanw.github.com/glfx.js/>

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.

------
mdaniel
That is the first time I've seen WebGL: what a _mess_.

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.

~~~
tomjen3
It is no more messy than the rest of GL.

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.

~~~
NickPollard
The issue is also that, since graphics are a performance intensive and ergo
low-level task, there isn't really a one-size-fits-all way of wrapping it up
in a higher level api.

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.

~~~
gambler
Is there a good reason why such API can't include low-level function _and_
high-level functions for common use cases?

~~~
exDM69
There are several examples where something like this has gone horribly wrong.
High level API's for "common use cases" tend to work only for writing one page
examples for text books but are completely useless for anything more serious.
One example of this is the CUDA API. They have a low level C API, which gives
you a good but a little verbose programming API (because GPGPU is
complicated). Then there's a high level API where you write the GPU code mixed
together with the CPU C++ code. It somewhat worked for the examples in the
Cuda manual but was useless for anything else.

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.

------
jerome_etienne
Considere <http://learningthreejs.com> tutorials on three.js.

This library does a good job at abstracting all the webgl

