Hey! raylib forum is closing!

After a year with not much movement in the forum I decided to close it.

The cost of maintaining the hosting is a bit high for the usage of the platform, updating the forum and managing it is also a bit cumbersome and the truth is that I'm already trying to maintain multiple other networks pretty more active than this forum.

I'll recommend you to move to the other raylib networks:

- For a forum style, use Reddit: https://www.reddit.com/r/raylib/
- For direct messaging and questions, use Discord: https://discord.gg/VkzNHUE
- To report issues, use GitHub: https://github.com/raysan5/raylib

- Also, remember you can contact me personally on Twitter: https://twitter.com/raysan5 or directly by mail to ray[at]raylib.com

If you feel generous, you can also contribute to the project on my Patreon: https://www.patreon.com/raylib

Thanks to you all for joining the project and help to improve it with your questions. Keep it up! :)

Best Regards,

Ray

PD. Closing will be effective by October 31th.

CPU 99% Usage

Hi Ray! I noticed that strongly overloaded processor,nearly 100%.Even when I am commenting drawing code - 50% CPU
Sorry for bad english.
For example
https://drive.google.com/file/d/0B_ojaSpCbPXYZWpnenFBdXJIN2s/view?usp=sharing

Comments

  • Hi dzanis! Thanks for your feedback!

    That's related to GLFW3, main while loop is continuously polling for events (inputs, window, etc.), it's the expected behaviour...

    Here it is some more information on this issue: https://github.com/raysan5/raylib/issues/17
  • Hi Ray! It is not good, it does not have time for logic. :neutral: If I have free time, then I try to replace GLFW to SDL2.Can I do this? :smile:
  • edited October 2016
    Hi dzanis!

    Actually, it's good, most games work this way. It just keep checking for events while there is no other work to do, if there is extra logic, it works on the logic. Some more references about this:

    http://stackoverflow.com/questions/23550423/high-cpu-usage-when-glfw-opengl-window-isnt-visible
    http://stackoverflow.com/questions/25938859/why-does-simple-glfw-program-eat-all-the-available-cpu-even-though-progam-is-idl

    About SDL2, actually, it will be a full replacement for raylib. SDL2 offers mostly the same functionality as raylib, not only window/input management like GLFW3.
  • Hi. The problem was solved !!! Just commented the line // # define SUPPORT_BUSY_WAIT_LOOP, file core.c in the function Wait .And now CPU < 3%
  • Hi dzanis!

    I was wrong on my previous comments, my fault. Actually high CPU usage was related to my busy wait loop, it was possible to improve that behaviour using system halt instructions (like Sleep(), usleep(), nanosleep()). Just improved that code part.

    The problem I find now is that using Sleep() on windows sometimes locks framerate to 30 fps, don't know why. Need to investigate a bit more this issue...

    Glad to read that it works good for you.

    By the way, current implementation, it's quite the same used by SDL2.
  • Thank you for making such an option as in SDL.
    "locks framerate to 30 fps" I'm still just learning, and I can not help much. But maybe the solution here is in SDL_Delay
    https://www.libsdl.org/tmp/SDL/src/timer/windows/SDL_systimer.c

    And I overload the processor with examples of physics, but so far this is not very important.
  • SDL_Delay(), that's exactly the function I used for reference, windows and linux versions. In raylib it's called just Wait(). :)
Sign In or Register to comment.