Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Jonny K

What could be restricting my framerate?

This topic is 5191 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a fairly fast CPU (about an Athlon XP 3400+ speed). I have one gig of PC3200 ram, and my system bus is 380mhz. (yeah, it''s an overclock, but it''s stable). My video card is a Geforce 4 Ti4200. Not great, but fast enough for my little game. Yet I can''t break this invisible FPS barrier! My game sits at about 85fps all the time, with VSYNC on, AND off. When I look at my CPU usage when running the game, it''s about 25%. And my FPS values are identical whether I''m running 1600x1200, or 640x480, so I don''t think it''s the video card. (my graphics are very basic - boxes with textures drawn on them). Both my in-game FPS reporter and FRAPS (FPS utility) report the same rates, so I think I can trust my FPS reporter. Turning sound off makes no difference. I''m drawing these simple boxes using display lists (but I wasn''t using lists before, and the problem was the same). And here''s more interesting info, even when viewing the game menu (all game updates are paused, rendering is paused, and a small simple menu is displayed instead), my FPS don''t get high. I''m using OpenGL with GLUT to handle my graphics, controls, and game flow (using GLUT''s timer functions). I''m using OpenAL for audio. Whoa, I just discovered something. If I disable sound, then exit the game and restart it, the FPS won''t go over 65 when I re-enter the game without sound! (the sound settings are stored in a config file). But if I go through the menu and re-enable sound, instantly the FPS jumps back to 85/87! HUH? This is a sample of how I''m playing sounds:
//Play an explosion sound

void Sound::explosion() {
	if (sound)
		alSourcePlay(sources[3]);
}
All the OpenAL setup stuff is right out of tutorials and the OpenAL programmer''s guide. I don''t get it. Any ideas? I''m going to try completely removing the sound code (commenting) and see what happens...

Share this post


Link to post
Share on other sites
Advertisement
Ok, this is really wierd. The game runs at 65fps until I play a sound, then it runs at 85fps. For instance, if I start a new game (with sound enabled), it will run at 65fps. But as soon as I shoot a missile (which plays a sound), the fps goes up and stays up.

I have NO idea.

Share this post


Link to post
Share on other sites
If it''s 85 fps it really sounds like you''re syncing to the refresh rate. Are you absolutely sure it''s disabled? What refresh rate are you in in those various resolutions that you''ve tried?

cheers
sam

Share this post


Link to post
Share on other sites
easy sanity test:

1) set refresh rate of monitor to 60 -> run app
2) set refresh rate of minotor to 75 -> run app
3) set refresh rate of minotor to 85 -> run app

if your app is the same FPS as the monitor refresh rate every time you didn''t properly turn vsync off. if it''s 85 for all of those settings then something wierd is going on for sure.

-me

Share this post


Link to post
Share on other sites
My monitor reports the refresh rate. As a test, I told the Nvidia control panel to run 120hz at 640x480. I load my game, and at that resolution I''m getting 65fps. The monitor confirms it''s at 120hz.

I''m freaking out here. I have no clue what the problem is. I completely disabled all sound (and even commented out the sound class). Since I did that, I''m stuck at 65fps all the time (since the only way I got to 85fps was from playing a sound).

It doesn''t make any sense! And it''s not that my system is messed up either, other games run at high framerates! :-(

And I performed a restart, so it''s not that either.

Share this post


Link to post
Share on other sites
run a profiler and see what part of your code is eating up all the frame time. google "devPartner Profiler".

-me

Share this post


Link to post
Share on other sites
Ok, no kidding, I commented out EVERYTHING but the loop that calculates FPS. No game updates, no menu displayed, no nothing except a single loop. Let me summarize the program:

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
draw_fps();
glutSwapBuffers();

And still 65fps.

I''m downloading that profiler now...but I''m totally lost. What happened? Does OpenGL have some FPS limit automatically active?

Share this post


Link to post
Share on other sites
Ok, it''s going on 2am here, so I''ve gotta go to bed. I''ll explore the code further tomorrow. Thanks for the help. :-(

Share this post


Link to post
Share on other sites
I think you have vsync turned on. Look at the options in the nvidia driver, OpenGL section.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!