Skip to content

Loading…

IE 9 error - BinaryLoader #257

Closed
renegademaster88 opened this Issue · 9 comments

4 participants

@renegademaster88

Ok so i am trying to get the renderer to use Canvas when WebGL is not available , i have noticed the Canvas Demos run like a dream in IE 9.

But when i called the Canvas Renderer instead of the WebGL renderer it didnt seem to work in IE 9? It works albeit very slowly in Chrome, and Firefox.

I get : SCRIPT5009: 'Worker' is undefined
THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
THREE.BinaryLoader.prototype={load:function(b){var d=b.model,c=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(d),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(d);b=(new Date).getTime();d=new Worker(d)

Three.js, line 454 character 236 in three.js

Looks like a problem with the BinaryLoader i am using for my data.

thanx again

@alteredq

All three.js models use web workers. Internet Explorer doesn't support web workers, so loader will not work there (neither binary nor ascii format).

@renegademaster88

oh dear another compatibility issue to deal with... is that why they use a call back function when the new thread finishes loading the geometry.

Is there a work around for this (like using Modernizr for instance) ?

@renegademaster88

i found a git hub project to emulate web workers in IE:
https://github.com/guyht/GWorker

@renegademaster88

After looking through the gworker code, it appears i need to declare

self.onmessage = function(event) {
//.... worker code
self.postMessage(response);
}

in order to get this to work, is this supposed to be the callback function that i use am using to load my geometry? Would it be possible to integrate this into the loader so that it worked with IE too ?

https://github.com/guyht/GWorker/blob/master/README.md

@alteredq

It may make sense to resurrect ajax model loader.

Long time ago we were loading models without workers, but this was making problems for large models (UI thread freezes, warning popups about unresponsive scripts, exceptions, or simply nothing happening).

But with canvas renderer large models are anyways not usable.

The simplest probably would be to fetch via Ajax regular worker model string, strip out worker parts and parse the rest as JSON (that's what Blender importer does).

@mrdoob
Owner

I think IE should implement workers rather than people doing "hacks" so stuff works on IE. Haven't we learnt this lesson from IE6 yet? ;)

@mrdoob mrdoob closed this
@renegademaster88

Yes i think IE has really shot themselves in the foot not supporting WebGL or web workers. People will stop using their browser if they can do cooler things elsewhere!

@georgik

It's pitty that workers are not available for IE.

For smaller models you can extract model JSON string and create model manually:

var loader = new THREE.JSONLoader();

var model = {
"version" : 2,
"scale" : 1.000000,
....
}

loader.createModel(model, createMesh, '');

Signature of createModel is: createModel = function ( json, callback, texture_path )
For more details see JSONLoader.js - https://github.com/mrdoob/three.js/blob/master/src/extras/io/JSONLoader.js

@georgik

Note: Workers are also not supported in Google web browser for Android 2.2.
Solution in previous post also works for Android 2.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.