[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] Lost Context
On Wed, Feb 24, 2010 at 10:27 AM, Gregg Tavares <email@example.com> wrote:
> Yet another lost context issue...
> How about adding a new error CONTEXT_LOST that gl.getError returns on all
> commands once the context is lost?
> Here's the issue that I think needs solving.
> You create a WebGL program that loads stuff asynchronously (like many of the
> current WebGL demos), while loading you lose the context (user sleeps the
> device, etc...), on recovery if the GL calls don't give CONTEXT_LOST than it
> doesn't seem like the initialization code will be able to distinguish
> between real failure "ie, this app can't run on this device" and lost
> context "ie, I need to start initialization over".
I agree that an indicator is needed. We have been discussing adding a
"context lost" extension to desktop OpenGL with a few vendors in
preparation for an ARB proposal, and some sort of indication that the
context has been lost is needed. The thinking was to make it a
glGetInteger query or similar, to avoid needing to call glGetError()
to determine that the context has been lost.
There are concerns with adding a new enum which isn't present in
either OpenGL ES or desktop OpenGL yet. If we do add an enum then we
should register it in the extension registry to avoid the possibility
of collision in the future.
Alternatively, we could add a function like "boolean isContextLost()"
or "boolean isContextValid()" to the context itself. This has the
disadvantage of introducing another type of error check that may need
to be queried by applications.
On the whole I would rather wait to see what form the planned desktop
GL extension takes before making a decision on the WebGL API. For the
time being we can use the asynchronous "context lost" event, and
perhaps synthesize INVALID_OPERATION in the case you describe. I think
it will still be possible to write apps that handle the lost context
case. Upon receiving a context lost event the app should completely
reset itself, so if it received GL errors during the last few calls
before it received the event, that shouldn't matter.
You are currently subscribe to firstname.lastname@example.org.
To unsubscribe, send an email to email@example.com with
the following command in the body of your email: