Automatic WebGLContestLost Recovery in SceneJS
SceneJS can automatically recover from lost WebGL context without disruption to your scene state, and
more importantly, without needing to reload anything.
SceneJS was the first to do this, but pretty soon this will be a standard feature of all retained-mode WebGL frameworks.
Check out the example below, in which we blow the context away every five seconds while you orbit the rising bubbles using the mouse:
So, what’s WebGLContextLost?
It’s the devil.
The GPU is a shared resource, and there are times when it might be taken away from our WebGL applications, such as when there are too many applications holding them, or when another application does something that ties up the GPU too long.
In such cases the operating system or browser may decide to reset the GPU to regain control. There’s a nice tutorial over at Khronos.org that describes how to handle this in our applications. It describes how application processes such as asset loads can be disrupted by context loss, and how an app will then need to reallocate its textures, VBOs, shaders etc. on a new context afterwards.
SceneJS retains all state and assets, such as matrices, geoemtry and textures etc in its scene graph. Then when the context is recovered after loss, it simply reallocates those assets on the new context.
sudo comments powered by Disqus