Jump to content
  • Advertisement
Sign in to follow this  

Problem with FPS in fullscreen...

This topic is 4433 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 am having some trouble with my FPS counter in fullscreen mode... In Windowed, it works. Here is my code:
void Timer::Update () 
{
	if (m_blnPerf_flag) 
		QueryPerformanceCounter ((LARGE_INTEGER *) &m_nCur_time); 
	else 
		m_nCur_time = timeGetTime (); 
   
	m_fTime_elapsed = (m_nCur_time - m_nLast_time) * m_fTime_scale;
	m_nLast_time = m_nCur_time;
	
	m_fClock += (m_fTime_elapsed * m_fFactor);
	if (m_fClock >= 1.0f) 
	{
		m_nSeconds++;
		m_fClock = 0.0f;
	}
	if (m_nSeconds >= 60) 
	{
		m_nMinutes++;
		m_nSeconds = 0;
	}
	if (m_nMinutes >= 60) 
	{
		m_nHours++;
		m_nMinutes = 0;
	}
	if (m_nHours >= 24)
		m_nHours = 0;

	m_fStamp = 0.0f;
	m_fStamp += m_fClock;
	m_fStamp += m_nSeconds;
	m_fStamp += m_nMinutes * 100; 
	m_fStamp += m_nHours * 10000;
}

Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by cppcdr
Anyone know why the code would work in windowed mode and not in fullscreen?
All I can guess is your FPS is higher, and you're having precision issues. Are you using timeGetTime() or QueryPerformanceCounter()? If you get too high a FPS, timeGetTime() will say that 0ms have elapsed since the last frame, which will probably cause problems.

Quote:
Original post by cppcdr
LONGLONG m_nCur_time;

It doesn't work because it always returns 1 when I do 1/m_fTime_elapsed.
Then what is the value of m_fTime_elapsed? 1.0f? And what is m_fTime_scale set to?

Share this post


Link to post
Share on other sites
I have checked my FPS with an external FPS counter and it gives me the same value when I am in windowed mode as my FPS counter (~250). When I go to windowed mode, my FPS counter marks 1, and the other counter (the one that I didn't make) says 300.

m_fTime_scale is a variable that I use to slow down time or speed it up. I find it is an easy way to modify the speed of my game. If I set it lower than 1.0f, it slows down, and if I set it higher, it speeds-up.

As for the m_fTime_elapsed, I don't know. I try to run the debugging in fullscreen but my computer refuses to do it...
When I do my debugging, it is in windowed mode...

How do I debug in fullscreen?

Share this post


Link to post
Share on other sites
OOPS! I made a mistake!

m_fTime_scale is the clock frequency.
m_fFactor is the time scale factor.

Humm...mayby I should rename the variables...

Anyway, is there any reason that it should be diffrent in fullscreen or in windowed?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!