Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

49 lines (39 sloc) 1.549 kB
<!DOCTYPE html>
<html>
<head>
<title>
CubicVR.js: Basic Primitives /w Predefined UVMappers
</title>
<script src="../../CubicVR.js" type="text/javascript"></script>
<script type='text/javascript'>
function webGLStart() {
// by default generate a full screen canvas with automatic resize
var gl = CubicVR.init();
var canvas = CubicVR.getCanvas();
if (!gl) {
alert("Sorry, no WebGL support.");
return;
};
// load scene from JSON constructor
var scene = new CubicVR.Scene("scene1.json");
scene.resize(canvas.width, canvas.height);
// remove ad-hoc cached JSON and Classes from memory
CubicVR.clearCache();
// initialize a mouse view controller
mvc = new CubicVR.MouseViewController(canvas, scene.camera);
// Add our scene to the window resize list
CubicVR.addResizeable(scene);
// Start our main drawing loop, it provides a timer and the gl context as parameters
CubicVR.MainLoop(function(timer, gl) {
var lus = timer.getLastUpdateSeconds();
for (var i = 0; i < scene.sceneObjects.length; i++) {
scene.sceneObjects[i].rotation[0] += lus*2.0+0.1*(i+1);
scene.sceneObjects[i].rotation[2] += lus*2.5+0.2*(i+1);
}
scene.render();
});
}
</script>
</head>
<body onLoad="webGLStart();"></body>
</html>
Jump to Line
Something went wrong with that request. Please try again.