Vijay Baskaran
Vijay Baskaran

Reputation: 939

three.js cordova apk for android

I'm developed simple 3D android app using cordova and three.js. Its is not working on few device(HTC one X, Samsung S6) and works perfectly in few device(ASUS, One + one). I have no idea why it is not working and It is showing blank white screen. Here is my js code

    var renderer = new THREE.WebGLRenderer( { antialias: true } );
    renderer.setPixelRatio( window.devicePixelRatio );
    renderer.setSize( window.innerWidth, window.innerHeight );
    $('#wrapper').html(renderer.domElement);
    element = renderer.domElement;
    var scene = new THREE.Scene();
    var camera = new THREE.PerspectiveCamera(100, window.innerWidth / window.innerHeight, 0.1, 10000);
    camera.position.set(0, 0, 0);
    var effect = new THREE.StereoEffect(renderer);
    effect.setSize( window.innerWidth, window.innerHeight );
    var axis = new THREE.AxisHelper(70000.5);
    //scene.add(axis);
    var cube = new THREE.Mesh( new THREE.CubeGeometry( 2.5, 4, 2.5 ), new THREE.MeshNormalMaterial() );
    cube.position.z=-4;
    scene.add( cube );
    var lastTimeMsec = null;
    function animate(timestamp) {
    effect.render( scene, camera );
    requestAnimationFrame(animate);
    }
    animate();

Can any one please let me know the issue.

Thanks in advance

Upvotes: 0

Views: 856

Answers (1)

Vijay Baskaran
Vijay Baskaran

Reputation: 939

We need to install one cordova plugin(cordova-plugin-crosswalk-webview ) before build. This allows three.js to support all the device.

Upvotes: 1

Related Questions