Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
49 lines (45 sloc) 1.52 KB
<!DOCTYPE html>
<html>
<head>
<title>
CubicVR.js: Basic Textured Cube
</title>
<script src="../../CubicVR.js" type="text/javascript">
</script>
<script type='text/javascript'>
function webGLStart(gl,canvas) {
// Create a camera, position at 1,1,1 and target at 0,0,0
var camera = new CubicVR.Camera(canvas.width,canvas.height,60);
camera.position = [1,1,1];
camera.lookat([0,0,0]);
// Create a material for the mesh
var boxMaterial = new CubicVR.Material({
textures: {
color: "../images/6583-diffuse.jpg"
}
});
// 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: boxMaterial,
uvmapper: {
projectionMode: "cubic",
scale: [1, 1, 1]
}
},
compile: true
});
// Add our camera to the window resize list
CubicVR.addResizeable(camera);
// Start our main drawing loop, it provides a timer and the gl context as parameters
CubicVR.MainLoop(function(timer, gl) {
// Render our object using the camera, pass identity matrix to represent no transform
CubicVR.renderObject(boxMesh, camera, CubicVR.IdentityMatrix);
});
}
</script>
</head>
<body onLoad="CubicVR.start('auto',webGLStart);"></body>
</html>
Something went wrong with that request. Please try again.