Improve uniform loading
This commit is contained in:
parent
31fcfd3d6b
commit
971ddbd08e
1 changed files with 266 additions and 246 deletions
|
|
@ -10,15 +10,15 @@ export const enableContextLostSimulator = (canvas: HTMLCanvasElement) => {
|
|||
isEnabled = true;
|
||||
|
||||
const gl = canvas.getContext('webgl2')!;
|
||||
const ext = gl.getExtension('WEBGL_lose_context');
|
||||
const ext = gl.getExtension('WEBGL_lose_context')!;
|
||||
|
||||
const simulateContextLost = () => {
|
||||
ext!.loseContext();
|
||||
ext.loseContext();
|
||||
console.log('lost');
|
||||
|
||||
const restoreTimeout = Math.random() * 500;
|
||||
setTimeout(() => {
|
||||
ext!.restoreContext();
|
||||
ext.restoreContext();
|
||||
console.log('restored');
|
||||
}, restoreTimeout);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue