Frame rate in the rendering window.?


#1

Hello,

What is the function to display frame rate in the rendering window ?

I also tried to pstats.exe but the application remains in the taskbar and noting gets displayed in the desktop.

Thanks,


#2

Put:

show-frame-rate-meter 1

in your Config.prc file.

I’m unable to parse your second sentence. I don’t know what it means “to pstats.exe”.

David


#3

Hello David,

Yes I have added - show-frame-rate-meter #t in the
etc/config.prc file as instructed in the manual but the frame rate is not showing up anywhere.

I also tried starting pstat.exe located within the bin folder by double clicking it. Though it got started, I was unable to see any window of pstat.exe on my desktop.The application remained stuck at the taskbar all the time.

Thanks,


#4

Hi

by chance, are you using your own .prc file and calling: load_prc_file, if so then you need to fix that file with show-frame-rate-meter #t
Be sure there is no “#” in front of the show-frame-rate-meter #t

Another thing to try and see if you are getting the right prc file is to fullscreen #t

wait I just had a thought… did you actually add the line show-frame-rate-meter #t yourself or did you edit an existing line in the file; maybe check down your prc file for an already existing show-frame-rate-meter #f. In my file it comes right after the line: want-pstats #f
which you would want to set #t if you want to see the PStats window. So always look to see if a line you want to set is already in your prc file.

Also in order to run pstats you need to add some lines of code to your program in main:

        if (PStatClient::is_connected()) {
          PStatClient::disconnect();
        }
        string host = ""; // Empty = default config var value
        int port = -1; // -1 = default config var value
        if (!PStatClient::connect(host, port)) {
          std::cout << "Could not connect to PStat server." << std::endl;
        }

compile it, then open a command prompt window and type “pstats” to start running pstats, then run your Panda program.


#5

Hello Tah,

Following is my code -


#include "pandaFramework.h"
#include "pandaSystem.h"
#include "configPageManager.h" 

PandaFramework framework;

int main(int argc, char* argv[]){

	LoadLibrary("libpandagl.dll");

	ConfigPageManager *cpMgr = ConfigPageManager::get_global_ptr(); 
    cerr << *cpMgr << "\n";

	//open a new window framework
	framework.open_framework(argc, argv);
	//set the window title to my Panda3D window
	framework.set_window_title("My Panda3D Window");
	//open the window
	WindowFramework* window = framework.open_window();

	// here is room for your own code
	// load the environment model
	NodePath environ=window->load_model(framework.get_models(),"models/environment");

	// reparent the model to render
	environ.reparent_to(window->get_render());

	//apply scale and position transforms to the model
	environ.set_scale(0.25, 0.25, 0.25);
	environ.set_pos(-8, 42, 0);

	window->setup_trackball();

	//do the main loop, equal to run() in python
	framework.main_loop();
	//close the window framework
	framework.close_framework();
	return(0);
}

And my prc file located at - D:\Panda3D-1.8.0\etc

is -



###########################################################
###                                                     ###
### Panda3D Configuration File -  User-Editable Portion ###
###                                                     ###
###########################################################

# Uncomment one of the following lines to choose whether you should
# run using OpenGL, DirectX or TinyPanda (software) rendering.
# There can only be one load-display line, but you can use
# multiple aux-display lines to specify fallback modules.
# When the module indicated by load-display fails, it will fall
# back to the next display module indicated by aux-display,
# when that fails, the next aux-display line, and so on.

#show-dll-error-dialog #t

load-display pandagl
#load-display pandadx9
#load-display pandadx8
#load-display pandagles
#load-display tinydisplay

# These control the placement and size of the default rendering window.
# A value of -2 for the origin means to center it on the screen,
# while -1 lets the window manager choose the position.

win-origin -2 -2
win-size 800 600

# Uncomment this line if you want to run Panda fullscreen instead of
# in a window.

fullscreen #t

# The framebuffer-hardware flag forces it to use an accelerated driver.
# The framebuffer-software flag forces it to use a software renderer.
# If you don't set either, it will use whatever's available.

framebuffer-hardware #t
framebuffer-software #f

# These set the minimum requirements for the framebuffer.
# A value of 1 means: get as many bits as possible,
# consistent with the other framebuffer requirements.

depth-bits 1
color-bits 1
alpha-bits 0
stencil-bits 0
multisamples 0

# These control the amount of output Panda gives for some various
# categories.  The severity levels, in order, are "spam", "debug",
# "info", "warning", and "error"; the default is "info".  Uncomment
# one (or define a new one for the particular category you wish to
# change) to control this output.

notify-level warning
default-directnotify-level warning

# These specify where model files may be loaded from.  You probably
# want to set this to a sensible path for yourself.  $THIS_PRC_DIR is
# a special variable that indicates the same directory as this
# particular Config.prc file.

model-path    $MAIN_DIR
model-path    $THIS_PRC_DIR/..
model-path    $THIS_PRC_DIR/../models

# This enable the automatic creation of a TK window when running
# Direct.

want-directtools  #f
want-tk           #f

# Enable/disable performance profiling tool and frame-rate meter

want-pstats            #t
show-frame-rate-meter  #t

# Enable audio using the OpenAL audio library by default:

audio-library-name p3openal_audio

# Enable the use of the new movietexture class.

use-movietexture #t

# The new version of panda supports hardware vertex animation, but it's not quite ready

hardware-animated-vertices #f

# Enable the model-cache, but only for models, not textures.

model-cache-dir $USER_APPDATA/Panda3D-1.8/cache
model-cache-textures #f

# This option specifies the default profiles for Cg shaders.
# Setting it to #t makes them arbvp1 and arbfp1, since these
# seem to be most reliable. Setting it to #f makes Panda use
# the latest profile available.

basic-shaders-only #f

Help me out here, I am not finding any frame rate meter showing up anywhere when I run the program from within IDE.

Thanks,
[/quote]


#6

Hi

Your code and Config.prc worked for me, well it didn’t like LoadLibrary(“libpandagl.dll”); so I removed it.

So are you seeing a full screen ? try it without full screen: fullscreen #f and set your win-origin -2 -2 to something like: win-origin 50 50

If you make these other prc file changes and don’t see a change with your window size then it could be finding another Config.prc somewhere, that is if you have another version of Panda loaded somewhere…


#7

Tah, are you using ANSI project settings or UNICODE project settings. I do not know why, the UNICODE project settings gets build but do not run - shows that previous error at run time on my pc. I am using Windows 7 SP1 X64

You said my code and prc file is working on your machine. Do you see the frame rate in the rendering window or in the command prompt console ? And how much does it show ?

I will follow along your last suggestion and let you know.

Thanks,


#8

Tah, you are right - the code within vs2008 is not picking up the configuration from my default prc file.

In order to enforce those configuration to take effect -
I had to use the following code before I make any object
of WindowFramework within the main program -


load_prc_file_data("", "show-frame-rate-meter 1");

load_prc_file_data("", "sync-video 0"); 

// disable v-sync with monitor refresh rate - otherwiise refresh rate will be stuck at 60 - 85

#9

Furthermore I am still unable to decipher what these properties means -


# These set the minimum requirements for the framebuffer. 
# A value of 1 means: get as many bits as possible, 
# consistent with the other framebuffer requirements. 

depth-bits 1 
color-bits 1 
alpha-bits 0 
stencil-bits 0 
multisamples 0 

and how to configure different values for them.


#10

Hi

Looks like I’m using UNICODE, with Windows XP.

Interesting, if sometimes it finds a prc file and sometimes it doesn’t. Does this have to do with the ANSI or UNICODE, and how it reads that file ? The only difference in writing that prc file is if you use a #t or #f or the 1 or 0.

framerate meter appears in the upper right corner of the Panda window.

One problem I had with an older program when I was first starting with Panda was that I had put the paths to Panda in the Properties->C+±>General and link and then had forgot about that and did the settings as shown in the manual, and I changed the Panda version so when I went to edit the prc file of the newer version, I didn’t see any changes because the it was looking in the older version paths. Just removing the paths in the Properties setting fixed that problem. Don’t know if you are having the same situation…

those other prc lines have to do with graphic bit planes that Panda can use to render to. Mine are set the same as yours. I wonder if that means if a person wanted to use the stencil buffer they would have to set it to 1. I have never changed any of those settings.


#11

Interesting … Panda3D configuration a little confusing … in my case if I try to compile the project as UNICODE I get error messages while compiling ! I am using Window 7 X64 and Visual C++ 2008. I guess I will stick with my current settings and move on learning the whole manual first and then come back do research on such nitty gritty details.