0
\$\begingroup\$

I have this simple app that displays a screen and handles the quit event:

while( SDL_PollEvent( &e ) != 0 )
    {
        //User requests quit
        if( e.type == SDL_QUIT )
        {
            quit = true;
        }
    }

If I compile this with SDL1.2 it runs fine, the quit event is handled immediately. However if I compile it for SDL2, then it takes ~5 seconds to get that event. And not just quit, but other events also, like mouse.

With sdl2 it takes ~95% of the cpu, while with sdl1.2 it's ~30-40%. The cpu is dual core, 1.2 ghz (pandaboard).

I suspect something, but I'm not 100% sure: I'm running this on ubuntu 12.04 which natively supports only sdl1.2. So I had to compile sdl2 from source code, as it's not available in that ubuntu.

Could this be the reason? Or any other clues what might be wrong? Thanks!

\$\endgroup\$
  • \$\begingroup\$ I have seen this behavior on SDL2 on Mac when my display window is completely hidden (by, in my case Xcode). For what it is worth. \$\endgroup\$ – david van brink Feb 1 '15 at 23:50
  • \$\begingroup\$ Hmm in my case the window is not hidden, also tried both full screen and window mode - still the same. I'm upgrading some drivers now to see if that will make any difference. \$\endgroup\$ – Lacho Tomov Feb 1 '15 at 23:56
1
\$\begingroup\$

I did not notice any performance issue with SDL_PollEvent, but be careful when compiling SDL2, you must have X11 dev headers and maybe some drivers headers like MESA. Without these, everything will run software and you may have performance issues, especially on low-cost hardware. So yes, you probably have to recompile SDL2.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.