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

Author Topic: Bottleneck sf::Event  (Read 3676 times)

0 Members and 1 Guest are viewing this topic.

sitizen

  • Newbie
  • *
  • Posts: 2
    • View Profile
Bottleneck sf::Event
« on: July 09, 2008, 12:21:28 am »
Hi Laurent and everybody,

I'm quite new to SFML and I like it very much so far, but I got stuck soon because of performance,  my plan is doing most of the rendering stuff in plain OpenGL (except fonts, probably the whole GUI).
Everything works quite ok  (rendering 2048 untextured cubes at 1100+ FPS), until i add any simple event handing like:

Code: [Select]

        ...initialize and go to main loop...


        sf::Event Event;
        App.GetEvent(Event);
        const sf::Input& Input = App.GetInput();

        bool  EscapeKeyDown = Input.IsKeyDown(sf::Key::Escape);

        if (EscapeKeyDown)
        {
             App.Close();
        }

        ...render some opengl stuff...



... which drops the FPS below 50!!! Same effect if i compile your OpenGL demo, the cube stops rotating if I move the mouse heavily (but the precompiled version works fine).  
I have the most current libs and am using using Code::Blocks/MingW, most current versions on WinXP SP2. Didn't find similar problems in the forums. Is there an known error, or better, a solution for this?
Any suggestions appreciated!

wkr
sit

Xylankant

  • Newbie
  • *
  • Posts: 32
    • View Profile
    • http://xylankant.xy.funpic.de
Bottleneck sf::Event
« Reply #1 on: July 09, 2008, 12:41:18 am »
Hi sitizen,

I'd put event-handling into a while()-construction like this:

Code: [Select]
sf::Event Event;
while(App.GetEvent(Event)){
     if((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
          App.Close();
}


Try this, I think it should work...

sitizen

  • Newbie
  • *
  • Posts: 2
    • View Profile
Bottleneck sf::Event
« Reply #2 on: July 09, 2008, 07:26:41 pm »
Hi,

I tried it out, the result is the same  :(

Wizzard

  • Full Member
  • ***
  • Posts: 213
    • View Profile
Bottleneck sf::Event
« Reply #3 on: July 11, 2008, 10:23:15 pm »
That is an interesting bug. I do not get it using the same setup with SFML 1.3.

heishe

  • Full Member
  • ***
  • Posts: 121
    • View Profile
Bottleneck sf::Event
« Reply #4 on: July 12, 2008, 02:28:25 pm »
since handling events is heavily a part of the operating system, you should try to run your program on other PCs and see if the bottleneck exists there too.