Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Display() is decreasing my FPS dramatically  (Read 4681 times)

0 Members and 1 Guest are viewing this topic.

Daevius

  • Newbie
  • *
  • Posts: 12
    • View Profile
Display() is decreasing my FPS dramatically
« on: March 15, 2008, 09:33:42 pm »
Hi,

As the title says. I have a FPS of only 64 with some light-weight drawings with OpenGL. I did some experimenting, it seems that Display takes all time, when I remove that function I get a huge FPS. I turned VSync on and off, but didn't make any difference.

Do I HAVE to call Display if I only use OpenGL output? What else do I wrong?

Thanks

TTK-Bandit

  • Newbie
  • *
  • Posts: 21
    • View Profile
Display() is decreasing my FPS dramatically
« Reply #1 on: March 15, 2008, 11:08:07 pm »
are you sure you dont call it twice ? if I remove the call to Display, then nothing is drawn.

I noticed this fps bug too, although my fps calculation said it was 62fps.
I found out it was a call to sleep I did, it seems that no matter how small the value is you pass to Sleep, you always sleep for at least 16ms.

edit from msdn :
Quote
The system clock "ticks" at a constant rate. If dwMilliseconds is less than the resolution of the system clock, the thread may sleep for less than the specified length of time. If dwMilliseconds is greater than one tick but less than two, the wait can be anywhere between one and two ticks, and so on.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Display() is decreasing my FPS dramatically
« Reply #2 on: March 16, 2008, 05:27:54 am »
62 FPS, 64 FPS... seems like your driver has v-sync turned on. Make sure it's either "turned off" or "controlled by application" in your graphics card driver control panel.
Laurent Gomila - SFML developer

Daevius

  • Newbie
  • *
  • Posts: 12
    • View Profile
Display() is decreasing my FPS dramatically
« Reply #3 on: March 16, 2008, 11:13:48 am »
Okay this is weird.

When I restarted my computer, it was suddenly much faster (perhaps I had some memory leaks with the testing before...?). Anyways, I have an FPS of 500 now ^^.

Also, the sleep improves FPS yes, but then I get a CPU of 100%. So I always sleep at least 1ms (even if that is ~16ms...can't help that) per display loop.

Thanks anyways...still I wonder why it was so slow yesterday...

TTK-Bandit

  • Newbie
  • *
  • Posts: 21
    • View Profile
Display() is decreasing my FPS dramatically
« Reply #4 on: March 16, 2008, 11:21:39 am »
laurent no im sure that vsync is off, besides I have a crt with 100hz, so it should be on 100 then, not  62.

Daevius

  • Newbie
  • *
  • Posts: 12
    • View Profile
Display() is decreasing my FPS dramatically
« Reply #5 on: March 16, 2008, 01:42:04 pm »
Quote from: "TTK-Bandit"
laurent no im sure that vsync is off, besides I have a crt with 100hz, so it should be on 100 then, not  62.


Yes, I'm sure my vsync was turned off either and my tft refresh rate is 75, so it should be ~75 instead of ~64.

TTK-Bandit

  • Newbie
  • *
  • Posts: 21
    • View Profile
Display() is decreasing my FPS dramatically
« Reply #6 on: March 18, 2008, 12:06:07 am »
found a solution:
call
timeBeginPeriod( 1 );
at the beginning of the main function and
timeEndPeriod( 1 );
at the end, they need to be in the main function, if you put them in the constructor/destructor of a global object it won't work.

 

anything