#### Archived

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

# help with framerate

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

## Recommended Posts

I was wondering what exactly framerate was especially in respect to an isographic 2d map. How do you determine frame rate.

##### Share on other sites
There''s a tutorial on www.gametutorials.com about displaying the framerate in OpenGL.

##### Share on other sites
Framerate is the number of frames rendered per unit of time. Every time you draw a frame, you increment a count of the number of frames drawn. Then you let some new quantity equal the number of frames drawn divided by how long the program has been running for.

However, if you do it that way, you only get the average framerate over the entire run of the program, which means it is generally slower than the instantaneous framerate because it includes the time spent loading resources. For a more practical way to determine framerate, you should reset your counters every three seconds or so. That way, you can get information about framerate drops or increases when they actually happen.

Here''s an example with C++ code:

// Updates the timer.void UpdateTimer(void){	static DWORD previousTime = GetTickCount();	static DWORD recentTime = 0.0;	static int recentFrames = 0;		elapsedTime = GetTickCount() - previousTime;	timeRatio = Ratio((float)elapsedTime, timeRate);	previousTime = GetTickCount();	recentTime += (double)elapsedTime;	totalTime += (elapsedTime / 1000.0);			// Reset the frames-per-second display every three seconds.		if(recentTime > 3000.0)		{			currentFPS = recentFrames / (recentTime / 1000.0);			recentTime = 0.0;			recentFrames = 0.0;		}			recentFrames++;	totalFrames++;}

"Last time, I asked: ''What does mathematics mean to you?'' And some people answered: ''The manipulation of numbers, the manipulation of structures.'' And if I had asked what music means to you, would you have answered: ''The manipulation of notes?''" - S. Lang

1. 1
2. 2
3. 3
Rutin
16
4. 4
JoeJ
13
5. 5

• 10
• 9
• 14
• 10
• 25
• ### Forum Statistics

• Total Topics
632646
• Total Posts
3007637
• ### Who's Online (See full list)

There are no registered users currently online

×