Nicolas Perdomo
Nicolas Perdomo

Reputation: 11

IEWebGL Plugin Three.js

I have created this code that rotates a cube with trackball using the three.js library and webgl. it works perfect in chrome and firefox but need it to work on Internet Explorer 10, I downloaded IeWebgl which supposedly Helps it work on IE10 but it does nothing but say webgl is not suported by internet, there are some instructions on their website but i do not understand them. here is my code..

Upvotes: 1

Views: 1127

Answers (1)

jeum
jeum

Reputation: 1096

It's possible to make ie+ieWebGL compatibles scenes.

To do this you can start from a demos' sources on ieWebGL site. The scene has to be build by another structure (some three.js scripts have to be loaded by require.js).

This one seems to work :

<script src="http://iewebgl.com/scripts/webglhelper.js" type="text/javascript"></script>
<script src="path/require.js"></script>

<script src="other_three.js-scripts"></script>

<script>

    // stub for "console" object, because IE does not have it, when page is not under debugger.
    var console = console || {
        'warn': function (msg) { },
        'log': function (msg) { },
        'error': function (msg) { }
    };

    var container, camera, controls, scene, renderer;

    function start()
    {
        require
        (
            ["path/build/three.min.js", "path/examples/js/controls/your_controls.js"],
            function ()
            {
                init();
                animate();
            }
        );
    }

    function init() 
    {
        container = document.getElementById('renderCanvas');

        // renderer
        renderer = new THREE.WebGLRenderer({ 'canvas': container });
        renderer.setSize(window.innerWidth, window.innerHeight);

        scene = new THREE.Scene();
        ...
    }
    ...
</script>

<!-- create proper element (native canvas element or IEWebGL plugin object element) depending on web browser and WebGL support -->
<script id="WebGLCanvasCreationScript"type="text/javascript">WebGLHelper.CreateGLCanvasInline('renderCanvas', start)</script>

Upvotes: 1

Related Questions