SFML community forums

General => General discussions => Topic started by: danw on September 19, 2016, 08:55:20 pm

Title: A question about rendering in a separate thread
Post by: danw on September 19, 2016, 08:55:20 pm
I have a question before I spend time converting a large program from SDL to SFML.

I read this document:

http://www.sfml-dev.org/tutorials/2.0/graphics-draw.php#drawing-from-threads

I need to process input in a "main" game loop.  I need very low latency on handling input events (<1ms).  If I am processing input in a render thread that is using vsync, then I'm only updating every 16ms, and that is 16 times too slow.

So, can somebody please tell me for certain if I can render graphics to a window in one thread, and handle input (keyboard presses etc) in another thread?
Title: Re: A question about rendering in a separate thread
Post by: danw on September 19, 2016, 09:37:45 pm
Well, this question seems dumb in retrospect.  I can easily make a small test program to find out.
Title: Re: A question about rendering in a separate thread
Post by: Laurent on September 19, 2016, 10:22:29 pm
So you found the tutorial, which demonstrates a piece of code that does exactly what you want. So... why do you ask? ;)
Title: Re: A question about rendering in a separate thread
Post by: danw on September 19, 2016, 11:54:32 pm
So you found the tutorial, which demonstrates a piece of code that does exactly what you want. So... why do you ask? ;)

Sorry, I would delete it if I could.

I'm just being paranoid.  I did a simple test and it works as advertised.