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

Author Topic: Multiple windows  (Read 2247 times)

0 Members and 1 Guest are viewing this topic.

roccio

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
    • Email
Multiple windows
« on: November 28, 2018, 09:17:24 am »
Hello,
I have a question regarding the correct way of using mnultiple windows with SFML (2.5.1).

Here is the general info:

- one window is the main program interface
- from this interface you can launch a thread that will open many other windows (al opened and managed in this new thread)

so the question are:

1) do I need to call setActive(true) for every window?
2) what happens if I set the vertical retrace to true? Every window will stop the code waiting the retrace?

thanks

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Multiple windows
« Reply #1 on: November 28, 2018, 09:49:29 am »
Quote
1) do I need to call setActive(true) for every window?
It depends what you do. Calling setActive(true) is necessary only if you call OpenGL functions yourself; if you use the graphics module, SFML will automatically do it for you.

And since a window is created and fully managed within a single thread, you don't even have to call setActive(false) (which would be needed if the window was created and used in different threads).

But why don't you just try the simple way, before asking if you need to do more complicated things? ;)

Quote
2) what happens if I set the vertical retrace to true? Every window will stop the code waiting the retrace?
I guess so, but since each window lives in its own thread, they won't block each other. Again, why don't you just try?
« Last Edit: November 28, 2018, 11:53:12 am by Laurent »
Laurent Gomila - SFML developer

roccio

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
    • Email
Re: Multiple windows
« Reply #2 on: November 28, 2018, 11:29:04 am »
Many thanks,

I have tried and not using setActive at all, and I have no issues. Just wondering if this is the correct way.