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

Re: [Public WebGL] Addition to WebGLContextLostEvent wrt extensions



On Fri, Apr 16, 2010 at 09:04, Gregg Tavares <gman@google.com> wrote:
On Fri, Apr 16, 2010 at 3:19 AM, Cedric Vivier <cedricv@neonux.com> wrote:
On Fri, Apr 16, 2010 at 00:48, Gregg Tavares <gman@google.com> wrote:
With the Reset/Resetable, the program is free to pretty much ignore the event system and just write this

var clearId;
function start() {
  init();
  clearId = setInterval(mainLoop, 10);
}
function mainLoop() {
  if (context.isContextLost()) {
    if (context.reset()) {
      clearInterval(clearId);
      start();
    }
  }
}

I think this is a good argument for moving resetContext() into the ResettableEvent interface [1] so that we won't see such code in the wild, that could keep a mobile device CPU powered on because of 'abusive' polling when screen/GPU is off.


That has nothing to do with resetContext(); That has to do only with the fact that the only current way to animate is with setInterval. 

(...) example using a render callback mechanism as discussed elsewhere.
 
 
Now the example doesn't do anything when not visible.


This is if the app uses a render callback, afaik this won't be the only mechanism to render something, so your previous "bad practice" example is still doable whereas it is by-design impossible if reset() is only accessible from the event.

Regards,