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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - SimonTheVillain

Pages: [1]
1
Window / [mac os x][sfml-1.6]Window from non-main-Thread
« on: February 05, 2011, 09:36:54 am »
Like the title says, i have tried to use the window class from outside the main thread with great success on every system except on mac os x.
As soon as i create a window object in an other thread than main, i get a(i'm not mac user but they seem to call it that way) waterball of death and a window with a white tile bar.

My Software is written in a way that makes it difficult to change the window and OpenGL managing thread to the main thread. So doe's anybody know a solution?


Here a piece of code that should represent the problem and should cause the same problem as described:

Code: [Select]


#include <SFML/Window.hpp>



void threadProc(void* userData){
    // Create the main window
    sf::Window App(sf::VideoMode(800, 600, 32), "SFML Events");

    // Get a reference to the input manager associated to our window, and store it for later use
    const sf::Input& Input = App.GetInput();

    // Start main loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();

            // Escape key : exit
            if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
                App.Close();
        }

        // Display window on screen
        App.Display();
    }

}

int main()
{
sf::Thread Thread(threadProc);
Thread.Launch();
Thread.Wait();

    return EXIT_SUCCESS;
}


Hope i made it clear, although my english is on a very low level.  :D

Pages: [1]
anything