WebGL-Inspector icon indicating copy to clipboard operation
WebGL-Inspector copied to clipboard

intercepting gl context before domready

Open jeromeetienne opened this issue 13 years ago • 3 comments

Description

  • currently it isnt supported
  • here is a test case https://gist.github.com/3556305

Impact

  • webgl inspector fails to work on all three.js examples because they init webgl before domReady

jeromeetienne avatar Sep 07 '12 08:09 jeromeetienne

I played with this and have a fix, here: https://github.com/benvanik/WebGL-Inspector/commit/6108beec15ad64f538a7935dd6d65145ba375c28

Unfortunately three.js stuff still doesn't work for other reasons - namely because three.js is bad about creating a bunch of contexts it doesn't use. Real apps should never do this, as creating extra contexts is expensive and wasteful - they should create one for detection then reuse it later on when they need to draw to it. You can run three.js apps with this change, but 3+ instances of WebGL Inspector will be setup and conflict with each other.

benvanik avatar Sep 07 '12 08:09 benvanik

can you give details on the 3 you got ? i see one in detector, and one in the renderer. But where is the third ?

jeromeetienne avatar Sep 07 '12 11:09 jeromeetienne

i tried the test case. one which got only one context. it produces an error.

gotFunction true
Uncaught ReferenceError: gli is not defined 

it points to this part of embed.js

 if (requestingWebGL) {
            // TODO: pull options from somewhere?
            result = gli.host.inspectContext(this, result);
Uncaught ReferenceError: gli is not defined
            var hostUI = new gli.host.HostUI(result);
            result.hostUI = hostUI; // just so we can access it later for debugging
        }

jeromeetienne avatar Sep 07 '12 14:09 jeromeetienne