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

Author Topic: Delayed loading graphics gives strange behaviour  (Read 1649 times)

0 Members and 1 Guest are viewing this topic.

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Delayed loading graphics gives strange behaviour
« on: July 18, 2013, 12:09:47 pm »
Hi

Normally we load all graphics when the game starts. Sadly we have had to make changes to speed up the initial loading time (customer requirements..) so now we load graphics during other stages in the game.

Our problem is, when we do this, we sometimes notice corruption/display of graphics on an incorrect window (we use two windows for our games).

I can't give a minimal example, as it's hard to reproduce, and I don't think its an SFML issue anyway. Does anyone have any ideas?

Does the window(s) have to be inactive (window.setActive(false)) before you load a graphic?

Thanks
Ed
SFML 2.1

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Delayed loading graphics gives strange behaviour
« Reply #1 on: July 18, 2013, 12:14:58 pm »
Is it the loaded graphics that are corrupted? What do you mean by "incorrect window"? Do you load things in a thread? On which OS(es) does it happen?

Quote
Does the window(s) have to be inactive (window.setActive(false)) before you load a graphic?
No.
Laurent Gomila - SFML developer

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Re: Delayed loading graphics gives strange behaviour
« Reply #2 on: July 18, 2013, 01:22:44 pm »
Is it the loaded graphics that are corrupted? What do you mean by "incorrect window"? Do you load things in a thread? On which OS(es) does it happen?

Quote
Does the window(s) have to be inactive (window.setActive(false)) before you load a graphic?
No.

OK we have fixed this, but anyway, the problem was that when we loaded a graphic, the next time you tried to render something to the second window (anything, it seems) then it will for 1 frame only, display the graphic just loaded.

We found that calling setActive(false) on BOTH windows prior to loading the graphic, has fixed this.

Windows 7/XP, no threading involved.
SFML 2.1