I am trying to measure the FPS that I am getting from my WebGL webpage, using FPSMeter. I would like to measure the FPS from within canvas element, in which I am rendering a graphic. The body and canvas are declared as follows:
<body onload="webGLStart();">
<canvas id="canvas" style="border: none;" width="800" height="500" align="center"></canvas>
</body>
I declared a new instance of FPSMeter and webGLStart() is defined as follows:
function webGLStart() {
var canvas = document.getElementById("canvas");
initGL(canvas);
meter.tickStart();
initShaders();
initBuffers();
document.onkeydown = handleKeyDown;
document.onkeyup = handleKeyUp;
tick();
meter.tick();
}
I am seeing the FPS meter on my page however the FPS begins at around 7 and drops to 0 after a second or so.
Does anyone know why this might be happening and how to fix it?
Many thanks!