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

Author Topic: A question about rendering in a separate thread  (Read 4447 times)

0 Members and 1 Guest are viewing this topic.

danw

  • Newbie
  • *
  • Posts: 8
    • View Profile
A question about rendering in a separate thread
« 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?

danw

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: A question about rendering in a separate thread
« Reply #1 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: A question about rendering in a separate thread
« Reply #2 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? ;)
Laurent Gomila - SFML developer

danw

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: A question about rendering in a separate thread
« Reply #3 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.

 

anything