Saturday, September 26, 2009

Pyramid in WebGL

To view the demo you will need a browser with WebGL enabled, such as a Firefox nightly build

I figured out how to use multiple verticies and multiple array objects to give each face color. WebGL is interesting to work with, but I'm getting a better grip on how vertex attribute arrays work and how to work with them. Things like the vertexAttribPointer call are a little odd, in my opinion, because you don't give it anything significant, and you don't get anything back, but it's really important. It makes me realize why people advocate functional programming.

In any case, the result is this pyramid, you can control its rotation with your mouse. As usual you can check the source out to see how its done.

Demo after the jump



0 comments:

Post a Comment