Jump to content
  • Advertisement
Sign in to follow this  
InfestedFurby

CPU spikes on OSX with SDL and OpenGL

This topic is 4090 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

Hey everyone, I'm having a problem with my game under OSX. Every so often, at completely random intervals, the game will freeze for a few hundred milliseconds, which is a big problem since my game is very twitch based. The game runs at about 90 fps normally, with only around 20% cpu usage, so there is plenty of cpu to go around. When I run the game on windows xp, the problem goes away. Here is a very high level view of my game loop. for(;;){ clear screen and depth buffer update game logic draw game SDL_GL_SwapBuffers();//copy back draw buffer to screen SDL_Delay(5);//wait 5 ms, needed to keep from pegging the cpu at 100% on windows } note that removing the SDL_Delay does nothing to the freeze problem on osx. Anyone have any ideas?

Share this post


Link to post
Share on other sites
Advertisement
What computer / OS are you running? I've had cases of this sort of thing with my older mac in any game.

Share this post


Link to post
Share on other sites
Are you processing SDL events? Sometimes the OS X version of SDL is kind of weird if you're not at least pumping the event queue.

Share this post


Link to post
Share on other sites
Have you tried using SDL_PollEvent() instead? Are you using multiple threads. Does the windowsXP machine run on dual or single core? Try setting CPU affinity to run program on one core. Anything running in the background on the Mac(updaters/monitors). Have you tried running a empty loop without running the gamelogic to see if the hiccup still exist?

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!