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

Author Topic: Multiple windows?  (Read 7043 times)

0 Members and 1 Guest are viewing this topic.

soconne

  • Newbie
  • *
  • Posts: 2
    • View Profile
Multiple windows?
« on: October 15, 2007, 06:48:51 am »
How do you handle creating and running events for multiple windows?  Would your main loop simply have:

while(...) {
    while(window1.GetEvent(Event)) { }
    while(window2.GetEvent(Event)) { }

    window1.SetCurrent();
    window1.Display();

    window2.SetCurrent();
    window2.Display();
}

Is this correct?  How are different rendering contexts handled?  Is a different context created for each window?  Also, how would you handle window creation if you wanted the 2 windows to SHARE a context?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Multiple windows?
« Reply #1 on: October 15, 2007, 08:16:13 am »
Your code should be correct.

Quote
How are different rendering contexts handled? Is a different context created for each window? Also, how would you handle window creation if you wanted the 2 windows to SHARE a context?

Every SFML window has its own OpenGL context, and all these contexts are shared.
Laurent Gomila - SFML developer

soconne

  • Newbie
  • *
  • Posts: 2
    • View Profile
Multiple windows?
« Reply #2 on: October 15, 2007, 04:39:48 pm »
Quote from: "Laurent"
Your code should be correct.

Quote
How are different rendering contexts handled? Is a different context created for each window? Also, how would you handle window creation if you wanted the 2 windows to SHARE a context?

Every SFML window has its own OpenGL context, and all these contexts are shared.


So each created window has access to the other's textures, buffers, ect...?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Multiple windows?
« Reply #3 on: October 16, 2007, 04:36:19 am »
Quote from: "soconne"
So each created window has access to the other's textures, buffers, ect...?

Yep
Laurent Gomila - SFML developer

 

anything