JavaScript 3D: Pre3D

14 Jan 2010 | By Alex Young | Tags javascript graphics

WebGL is coming, and is in fact already present in developer preview builds of Firefox, WebKit nightly and Chrome. Technically it’s possible to draw 3D graphics without WebGL. The Pre3d library by Dean McNamee does this, citing Kragen’s torus as inspiration.

It has a simple API, with syntax like this:

var path = new Pre3d.Path();
path.points = new Array(size);
path.curves = new Array(size);

Dean has some interesting comments in the source for pre3d.js with details on his design philosophy:

Because Arrays always go through the key lookup path, and there is no way to do a named lookup, it is faster to use objects than arrays for fixed size storage. You can think of this like the difference between a List and Tuple in languages like python

What about WebGL?

If you’re dying to start using WebGL now, I found an excellent blog called Learning WebGL. It has thorough lessons and a wiki.

blog comments powered by Disqus