I am trying to use a SFML window on a separate thread from the main thread (which hosts a GTK window). Whenever I try this, the window immediately disappears. It still runs DispatchEvents, Display, Clear, and IsOpen() returns true. Am I doing something wrong?
Here is a minimal example:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using SFML.Graphics;
using SFML.Window;
namespace MessageView
{
class EntryPoint
{
static RenderWindow window = new RenderWindow(new VideoMode(400, 400), "test");
static Thread thread = new Thread(run);
static bool running = true;
static void run()
{
while (running)
{
window.DispatchEvents();
window.Clear();
window.Display();
}
}
static void Main(string[] args)
{
//thread.Start(); //window will immediately disappear
//run(); //runs fine
}
}
}