I am not able to listen to “webglcontextrestored”. I have put alert and doesnot show up. Any clue?
webglcontextrestored
is automatically triggered by the WebGL API and not by three.js
. Read the following documentation for more details:
three.js
only restores it internal state after a context lost. But it might be necessary to execute additional logic on app level.
I am bit new to three.js. Can you please have a look at following fiddle see what am i missing? -
Have a look at this fiddle: Edit fiddle - JSFiddle - Code Playground
When using WebGLRenderer.forceContextLoss()
, you also have to use WebGLRenderer.forceContextRestore()
in order to force the context restore.
But forceContextRestore doesn’t work when context lost happens organically in the browser rather than using forceContextLoss And in that case, even if I use forceContextRestore, it will not restore my state. Is that right?
If thats so, what should I do to restore in that case?
WebGLRenderer.forceContextLoss()
and WebGLRenderer.forceContextRestore()
are used to simulate a context loss and restore based on the WebGL extension WEBGL_lose_context
.
If you have a real context loss, the mentioned events should be triggered automatically. If this is not the case, I recommend you file a bug at the browser vendor’s issue tracker.
When I call these two functions frequently, the browser’s memory grows rapidly.
It seems to bring in extra memory when call forceContextRestore ,
how to avoid this problem
In what browser does this happen?
So happy to get your reply , On Google, I just solved this problem , I had to dispose the scene before calling forceContextLoss()
Dear author, hello
It seems that the matrix does wrong change when call the Object3d.add method in webgpuRender。
two month ago , I execute the following two lines of code and in webgpuRenderer camera performs the exact opposite shift. In webglRenderer, camera can be localized normally relative to player
this.player.add(this.camera);
this.player.add(this.obj3d);
Please open a new topic for this issue and ideally provide a live example that demonstrates what goes wrong.