View Full Version : Optimizing for FPS
04-09-2001, 05:35 AM
I've been working with the NeHe tutorials on my mac. I've gotten up to lesson 23, and I got inputsprocket working for the input. Everything goes fine. The problem I have is that I get only about 3 frames per second. I've got a G3 400 with the built-in Rage 128 card. On other games, such as GL Tron, I get up to 60 fps, and on Diablo II I get about 35-40. My OpenGL app is signifigantly simpler.
What can I do to optimize my code?
So far I have done the following:
*Modified to use Display Lists
*Implemented Multiproccessor API to do seperate input threads and render threads (so that input doesn't slow down the rendering, it was before.)
*Changed filter type from GL_LINEAR to GL_NEAREST
*I've taken out the lighting too http://www.opengl.org/discussion_boards/ubb/smile.gif
What else can I do?
04-09-2001, 06:06 AM
It's difficult to guage how bad your performance is because I don't know what you are drawing. There are many things which can hose your performance, not least of which is simply drawing a lot of stuff. At 3fps it may be that you aren't getting hardware acceleration. This may be because you have selected a slow visual, with destination alpha for example (don't take this as gospel for your situation, I'm generalizing). One big thing is to make sure you use the glbindtexture call to avoid downloading your textures each time you switch, that could REALLY make a difference. The other thing may be some nasty slow state you have on. OpenGL is a state engine, and if you enable some state at the start it will be forever enabled until you disable it. So you may have something on like alpha testing and alpha blending which is slowing you down, make sure you're careful about state management. Some things are jusp plain slow on many implementations, such as glReadPixels. You may be using too much texture memory. Your primitives may be slow, for example drawing independent triangles instead of a tri strip. One thing you can try from the outset is to change the resolution you draw at and see what difference that makes, this should tell you whether you're looking at some geometry or bandwidth issue or whether it's a predominantly fill related problem, this will help you narrow it down.
Well there should be enough there to be getting along with for now.
04-09-2001, 09:28 AM
I think lesson 23 is the world tutorial with dx input http://www.opengl.org/discussion_boards/ubb/frown.gif and multiple textures, if not then these might not be of so much use.
1) What framerate do you get with lesson 10 (I think it is 10- the first 3d world tut)?
2) Are you just using the provided map? ***
The engine will only deal with a limited number of triangles.
3) Are you sure that you are getting 3fps?, is your timeing/calulations correct?, when you walk around does it seem as slow as 3FPS?.
4) Are you sure that it is the rendering that is slow?, maybe it the input that is slow, or maybe it is just slow anyway without doing anything.
5) Does it run slow on other computers.
*** I am currently making a level editor/importer/converter which will export levels suitable for NeHe lesson 23, however is is only for windoze and is made is MFC and so isn't portable. http://www.opengl.org/discussion_boards/ubb/frown.gif
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.