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

Re: [Public WebGL] Addition to WebGLContextLostEvent wrt extensions

On Apr 7, 2010, at 8:16 PM, Gregg Tavares wrote:

> ...I think that's a reasonably simply structure and requires some pretty standard logic in the internal functions. It requires that the app knows how to save its state and restore to exactly that same state so you can continue where you left off. But that's true for any logic that needs to make the app survive context lost. It's not hard to imagine a data driven app which uses a database library to do the save and restore. That would make the burden on the author for save and restore as light as possible.
> -----
> ~Chris
> cmarrin@apple.com
> I'd need to see more details to see how this works. How do all the async calls that startAssetLoad sets up deal with WebGLContextLost/WebGLContextRestored? If it takes 3 minutes to load the assets (not unreasonable for a game) then it's very possible, you could lose and regain the context after startAssetLoad is called and before initFinishedFunc is called.
> You could be in several unknown states when your context is lost and again when it's restored.  This is what seems like an issue with it auto-restoring. It seems like the logic for dealing with auto-restore is extremely hard where has if once it's bad it's bad until the app calls reset it's very easy.

I think you'd just have to have some logic in stop which stops any pending loads and tosses any already loaded images. Or maybe you can keep loading images, just not add them as textures. So maybe the better logic would be to load all images first and not make them textures. When load is complete you'd make them all textures. You wire that logic into the context lost/restored mechanism so you don't try to load textures while the context is lost and I think you'd have a workable scheme. Of course this requires you keeping around all images separately from their textures. Maybe that's not such a bad idea?

Anyway, all of this can be encoded into a library to deal with all this for the author. You could even have two versions, one that loads images on the fly and one that retains them.


You are currently subscribe to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email: