Jump to content

Measure FPS


MattePatte
 Share

Recommended Posts

Hello friends!

 

I don't understand how to use engine.beginFrame(). It says in the documentation that it should measure the Frames Per Second but i don't understand how it works.

 

If anyone could show me a example that would have been awesome.

 

I have tried to measure the FPS by my self and it looks something like this.

var lastCalledTime;var fps;var stop = 0;    var renderLoop = function () {        // Start new frame	if(!lastCalledTime) {	     lastCalledTime = new Date().getTime();	     fps = 0;	     BABYLON.Tools.QueueNewFrame(renderLoop);	     return;        }	delta = (new Date().getTime() - lastCalledTime)/1000;	lastCalledTime = new Date().getTime();        fps = 1/delta;        // a stop variable since it hard to se the fps when it's displayed 60 times per         //second,         if(stop == 30){                    // a div element to display the fps            fpsDiv.innerHTML = parseInt(fps);				                stop = 0;        }	engine.beginFrame();        scene.render();	// Present        engine.endFrame();        // Register new frame	BABYLON.Tools.QueueNewFrame(renderLoop);        stop++;};

It shows a frame rate between 60 and 0 but it's usually quite low around 16 FPS.

I have a piece of shit computer so that doesn't surprise me, but i want to be sure that i really measure the fps.

 

Thanks! 

Link to comment
Share on other sites

  • 1 year later...

a better way than Google to find something :

 

go here : http://doc.babylonjs.com/

type "fps" in the search zone in the top right corner, and that's all  ;)

 

Maybe (although I never really like to restrict my search to just one site), but people do get here via Google so I think it's important to make sure the answers here are correct  :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...