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

Author Topic: Windows Messages  (Read 4206 times)

0 Members and 1 Guest are viewing this topic.

Zweistein

  • Newbie
  • *
  • Posts: 29
    • View Profile
Windows Messages
« on: December 10, 2010, 04:00:22 pm »
Hey,

For some reason my RenderWindow is not answering to events like moving the window around or minimize, maximize. The OpenGL stuff is rendered correctly, but the windows does not respond to any windows7 messages. I render in a thread.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Windows Messages
« Reply #1 on: December 10, 2010, 04:04:52 pm »
Do you call GetEvent?
Laurent Gomila - SFML developer

Zweistein

  • Newbie
  • *
  • Posts: 29
    • View Profile
Windows Messages
« Reply #2 on: December 10, 2010, 04:14:04 pm »
Yes, i do.
I got the error. I created the Window in an other Thread. But i thought setActive() is implemented for the reason to switch the context to the current thread. its also working witht he opengl stuff, but not with the windows messaging stuff.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Windows Messages
« Reply #3 on: December 10, 2010, 04:35:52 pm »
SetActive activates the OpenGL context, this has nothing to do with event handling.

OpenGL contexts can be used in other threads, but not events (that's a limitation of the OS).
Laurent Gomila - SFML developer

Zweistein

  • Newbie
  • *
  • Posts: 29
    • View Profile
Windows Messages
« Reply #4 on: December 10, 2010, 10:01:29 pm »
Ok, now i created the Window in thread X, this way i can ask for input from thread X.
On the other site i want to render in thread Y. But everytime i try to use m_Window->setActive(true) in thread Y it says: "Failed to activate the window's context".

What are the conditions to make it work?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Windows Messages
« Reply #5 on: December 10, 2010, 10:38:02 pm »
You must call window->SetActive(false) from the other thread, before activating it in the new thread.
Laurent Gomila - SFML developer

Zweistein

  • Newbie
  • *
  • Posts: 29
    • View Profile
Windows Messages
« Reply #6 on: December 10, 2010, 11:12:07 pm »
Ok, i got 3 Problems that are fixed now:
1) i didn t called SetActive(false)
2) I hadn t had a sf::Context in both Threads
3) I called m_Window->Display() in Thread X and i think this activates the context for thread X again?

lg

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Windows Messages
« Reply #7 on: December 10, 2010, 11:18:01 pm »
Quote
3) I called m_Window->Display() in Thread X and i think this activates the context for thread X again?

Yes it does.
Laurent Gomila - SFML developer