Skip to content

Instantly share code, notes, and snippets.

@nklsrh
Last active December 19, 2015 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nklsrh/5963154 to your computer and use it in GitHub Desktop.
Save nklsrh/5963154 to your computer and use it in GitHub Desktop.
// set the scene size
var WIDTH = 640,
HEIGHT = 360;
// create a WebGL renderer, camera
// and a scene
var renderer = new THREE.WebGLRenderer();
// start the renderer
renderer.setSize(WIDTH, HEIGHT);
// attach the render-supplied DOM element (the gameCanvas)
var c = document.getElementById("gameCanvas");
c.appendChild(renderer.domElement);
...
function draw()
{
// draw THREE.JS scene
renderer.render(scene, camera);
// loop the draw() function
requestAnimationFrame(draw);
// process game logic
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment