Add timing
This commit is contained in:
parent
039f7e8cef
commit
1ac4113b0d
2 changed files with 27 additions and 2 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import * as twgl from 'twgl.js';
|
||||
import { TimeIt } from '../helper/timing';
|
||||
|
||||
export class Renderer {
|
||||
private gl: WebGL2RenderingContext;
|
||||
|
|
@ -35,9 +36,11 @@ export class Renderer {
|
|||
}
|
||||
|
||||
start() {
|
||||
requestAnimationFrame(this.render.bind(this));
|
||||
requestAnimationFrame(this.timedRender);
|
||||
}
|
||||
|
||||
private timedRender = TimeIt(this.render.bind(this), 240);
|
||||
|
||||
private render(time: number) {
|
||||
const gl = this.gl;
|
||||
|
||||
|
|
@ -58,6 +61,6 @@ export class Renderer {
|
|||
twgl.setUniforms(this.programInfo, uniforms);
|
||||
twgl.drawBufferInfo(this.gl, this.bufferInfo);
|
||||
|
||||
requestAnimationFrame(this.render.bind(this));
|
||||
requestAnimationFrame(this.timedRender);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue