Skip to content
This repository
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 56 lines (47 sloc) 1.635 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
<!DOCTYPE html>
<html>
  <head>
    <title>
      CubicVR.js: Basic Texured Cube /w Scene
    </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"
              }
            },
            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();
        });
      }
    </script>
  </head>
  
  <body onLoad="CubicVR.start('auto',webGLStart);"></body>
  
</html>
Something went wrong with that request. Please try again.