Here is an attempt to make it very easy to write WebGL programs:

http://dl.dropbox.com/u/18859068/EasyWebGL20110525.zip

Here is a summary found in the file oscillator.htm:

// This is an attempt to emulate in JavaScript/WebGL
// the ease of use found in Python/VPython/OpenGL (vpython.org).
// In VPython, one writes simple programs that generate
// navigable real-time 3D animations as a side-effect of
// computations.

// The following example uses vector operations only
// sparingly compared to VPython, due to the absence of
// operator overloading in JavaScript (e.g. vector1+vector2).
// The example is intended as a simple proof of concept of
// hiding all the extremely technical WebGL stuff, to make
// it feasible for ordinary mortals to do 3D in a browser.
// It is based on the well-known spinning box WebGL demo.

// There's only one object (box) whose size is modifiable.
// The color of everything is cyan, lighting is primitive.
// There's some kind of timing glitch that is addressed by
// the kludge of an alert box (in visual.js). You need to
// acknowledge the alert, then on the next appearance you
// need to check the box to show the alert no more. I would
// appreciate advice on this problem: rendering is done but
// doesn't appear until the end of the program, despite use
// of gl.flush() and gl.finish().

Bruce Sherwood

============================================================
FRIAM Applied Complexity Group listserv
Meets Fridays 9a-11:30 at cafe at St. John's College
lectures, archives, unsubscribe, maps at http://www.friam.org

Reply via email to