[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Extension proposal: WEBGL_lose_context



So I implemented this in _javascript_ 

The implementation is here

https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/debug/webgl-debug.js

An example of using it is here

https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/debug/lost-context-simulator-test.html

Note: it does not work in Safari or Chrome because of bugs in WebKit. Once those bugs are fixed it should work there.

To use include webgl-debug.js then after creating your context call

ctx = WebGLDebugUtils.makeLostContextSimulatingContext(gl);

After that you can call ctx.loseContext and ctx.restoreContext to simulate the context getting lost and restored.

The one thing that's different is you can't use canvas.addEventListener('webglcontextlostevent', listener,...) . Instead you have to use ctx.registerOnContextLostListener. Same for webglcontextrestoredevent.

I don't see that difference as enough justification to clutter the register with an extension for this.

To use that extension in any meaningful way means either littering your code with calls to loseContext and restoreContext or wrapping the entire context and calling it on a call count or randomly. My point is, to use the proposed extension in any meaningful way requires lots of code so having a 2 line change to use this _javascript_ version hardly seems like a justification for an extension.