Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
57 lines (50 sloc) 1.77 KB
<!DOCTYPE html>
<html>
<head>
<title>
CubicVR.js: Basic Texured Cube /w Scene and MouseViewController
</title>
<script src="../../CubicVR.js" type="text/javascript">
</script>
<script type='text/javascript'>
function webGLStart(gl,canvas) {
// Add a box to mesh, size 1.0, apply material and UV parameters
var boxMesh = new CubicVR.Mesh({
primitive: {
type: "box",
size: 1.0,
material: {
textures: {
color: "../images/6583-diffuse.jpg",
bump: "../images/6583-bump.jpg"
}
},
uv: {
projectionMode: "cubic",
scale: [1, 1, 1]
}
},
compile: true
});
// New scene with our canvas dimensions and default camera with FOV 80
var scene = new CubicVR.Scene(canvas.width, canvas.height, 80);
// SceneObject container for the mesh
var boxObject = new CubicVR.SceneObject(boxMesh);
// Add SceneObject containing the mesh to the scene
scene.bind(boxObject);
// set initial camera position and target
scene.camera.position = [1, 1, 1];
scene.camera.target = [0, 0, 0];
// 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) {
scene.render();
});
// initialize a mouse view controller
mvc = new CubicVR.MouseViewController(canvas, scene.camera);
}
</script>
</head>
<body onLoad="CubicVR.start('auto',webGLStart);"></body>
</html>
Something went wrong with that request. Please try again.