3DWorld.js demo

This is a simple webpage demo-ing the 3DWorld.js webgl framework.

You can create a simple 3D scene by including the javascript files 3DWorld.js and mjs.js, then adding the following code to your webpage:

  1. var world = new GLWorld('canvas');
  3. var img = 'http://www.lemniscaat2.nl/madeintheusa/images/wikipedia.jpg';
  4. var box = new GLBox().pos(2,.5,0)
  5.                      .rot(20,-120,0)
  6.                      .color(1,1,1)
  7.                      .texture(img);
  8. var box2 = new GLBox().pos(-2,.5,0)
  9.                       .scale(1.5,1,1)
  10.                       .color(0,1,0);
  11. var sphere = new GLSphere().color(.8,0,.3);
  12. var plane = new GLPlane().color(1,1,.1)
  13.                          .pos(0,-0.6,0)
  14.                          .scale(3,3,3)
  15.                          .rot(30,0,0);
  17. world.add(box, box2, sphere, plane);

The main goal of the framework is simplicity. The example on the right uses the code above, as well as a few extra lines of code for animation and mouse interaction. The functions emulate the way jQuery works (calling the functions with no parameters acts as getters), and can be used prior to initializing the scene, or after.

For comments or suggestions please use the topic page on the Khronos Group forum.