The code below is showing black screen even though body background color is #135462. I am thinking that its showing black screen due to rendering code. But not able to remove that black screen and getting the background color.
Object also is not displaying on the screen. My object link can be found here: https://www.dropbox.com/s/ukw7k1vyqkg4f7d/SupermanSmall.json?dl=0
Anyone have any ideas on why this is happening?
<!DOCTYPE html>
<html lang="en">
<head>
<title>My three.js</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
background:#135462;
color:#fff;
padding:0;
margin:0;
overflow:hidden;
font-family:georgia;
text-align:center;
}
</style>
</head>
<body>
<script src="js/three.min.js"></script>
<script src="js/loaders/BinaryLoader.js"></script>
<script src="js/loaders/ObjectLoader.js"></script>
<script src="js/Detector.js"></script>
<script>
if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
var container;
var camera, scene, renderer;
var windowHalfX = window.innerWidth / 2;
var windowHalfY = window.innerHeight / 2;
init();
animate();
function init() {
container = document.createElement( 'div' );
document.body.appendChild( container );
camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 0.1, 10000 );
camera.position.z = 5;
scene = new THREE.Scene();
scene.add( camera );
var loader = new THREE.ObjectLoader();
loader.load( "obj/superman/SupermanSmall.json", function(obj){
scene.add(obj);
});
renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
container.appendChild( renderer.domElement );
}
function animate() {
requestAnimationFrame( animate );
camera.lookAt( scene.position );
renderer.render( scene, camera );
}
</script>
</body>
</html>