Recent

Author Topic: OnIdle and opengl  (Read 4317 times)

laggyluk

  • Jr. Member
  • **
  • Posts: 69
OnIdle and opengl
« on: February 05, 2013, 08:27:48 pm »
I've been using application.onidle event for rendering scene in my project, had lots of fps(200+) but at some point it dropped to ~60 and stayed that way. Even if I comment out everything related to my game engine, initialization and drawing. in task manager app takes only 2-3% cpu time, shouldn't on idle use 100%? (or at least 25% when cup has 4 cores i guess). I need all the power that can be squeezed, any suggestions?

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: OnIdle and opengl
« Reply #1 on: February 05, 2013, 11:57:42 pm »
You may have forced vsync on the Graphics driver settings. Nothing wrong with that really, it's healthy for the hardware  ;)

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: OnIdle and opengl
« Reply #2 on: February 06, 2013, 12:03:06 am »
Quote
I need all the power that can be squeezed, any suggestions?

What widget-set do you use ?
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

HomePlaneR

  • New Member
  • *
  • Posts: 34
Re: OnIdle and opengl
« Reply #3 on: February 06, 2013, 12:17:46 am »
I've been using application.onidle event for rendering scene in my project, had lots of fps(200+) but at some point it dropped to ~60 and stayed that way. Even if I comment out everything related to my game engine, initialization and drawing. in task manager app takes only 2-3% cpu time, shouldn't on idle use 100%? (or at least 25% when cup has 4 cores i guess). I need all the power that can be squeezed, any suggestions?

Maybe you touch the priority of your program process? Over what OS do you have this problem?

laggyluk

  • Jr. Member
  • **
  • Posts: 69
Re: OnIdle and opengl
« Reply #4 on: February 06, 2013, 03:47:37 pm »
What widget-set do you use ?
LCL i guess?
I'm on win 7 64bits. App has 3 forms with few buttons on them, one listbox and memo. opengl uses one form's dc for drawing.
I didn't change anything in video card settings, vsync is not enabled.
Empty project has 5k fps and uses 25% of cpu time.
I'm thinking that maybe loaded heavy shader code can slow down the gpu so much that cpu time remains 'unused' by app?


User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: OnIdle and opengl
« Reply #5 on: February 06, 2013, 05:53:37 pm »
No, 60 fps is usually limited by OS, or other graphics driver setting such as v-sync. Applications do have some level of control to them, but that again depends on driver settings. Heavy stress in gpu would show different numbers, in 1 direction or the other.

If you want to try maximizing physics time and others, you might be able to do the timing yourself. Lets assume it will stay at 60 fps, then time you have per frame is 1000ms/60 =~ 16. I also assume that the frame wait is done when screen SwapBuffers is done. So you could be comparing the time left to next frame, do game stuff and then swap. I know it's very delicate thing to do though, just 1 logic error can make it look a little laggy.

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: OnIdle and opengl
« Reply #6 on: February 06, 2013, 08:16:26 pm »
Quote
LCL i guess?

OK (but not enough) ...

What interest me is what OS you use (Windows, Linux, Mac Osx,...)
and what widgetset (For Linux : GTK2 or Qt..., for Windows : win32, For OSX : carbon, ...)

If you use Linux and "Classical" Lazarus with default widgetset, you use GTK2. (and that is the problem, try Qt)
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

 

TinyPortal © 2005-2018