show frame rate meter

Hi!!!
i’d like show the frame rate meter in my game. I have searched in the manual and i have found this:

load_prc_file_data ("", "show-frame-rate-meter #t");

i put this in my main function, at the begin of function, but when i run my program, there’s not the frame rate meter!!!
why?!?!?
:open_mouth:

It needs to go before directstart.

Or, after you’ve already started, you can simply call base.setFrameRateMeter(True).

David

Um, the OP is using C++, not Python.

In the case of C++, you should probably call it before opening the window or so.

great!
I must call load_prc_file_data before open a new window! :wink:
thanks!

but with an empty scene, there are 60 fps… why?
this is the code:

#include <pandaFramework.h>
#include <pandaSystem.h>

#include <load_prc_file.h>

PandaFramework framework;

int main(int argc, char *argv[]) {
	framework.open_framework(argc, argv);
	
	load_prc_file_data("", "show-frame-rate-meter 1");
        // if i remove this row, nothing changes
	load_prc_file_data("", "ssync-video 0");
	
	framework.set_window_title("Hello World!");
	WindowFramework *window = framework.open_window();
	
	window->enable_keyboard();
	framework.main_loop();
  
	framework.close_framework();
	return 0;
}
1 Like

There’s a typo here (it’s sync-video):

ops :wink: but the problem persists !

Have you tried calling it before open_framework?

nothing changes! :frowning:

The limit at 60fps implies that you’re running with video sync. If you can’t disable video sync with the sync-video configure variable, it implies that the graphics driver is overriding this option.

Check your driver settings for video sync or sync-to-video-rate or sync-to-refresh.

David

If you’re using directx with multisamples, there’s a bug which automatically syncs the video to 60FPS. I’ll try to check in a fix for this later.

another programmatic way to do it

PT(FrameRateMeter) meter = new FrameRateMeter("fps"); 
meter->setup_window(gTheWindow->get_graphics_output());