views:

46

answers:

2

Hi,

I'm using GLFW for creating OpenGL context and capturing user's input and I wanted to capture whole input actions from other thread than OpenGL context was initially created. Am I able to achieve this by using GLFW, SDL or similar library or need I, for example, use different libraray for each task? And if so, which library would you recommend for capturing input? (it need to be cross-platform). Thanks in advance.

A: 

OpenGL and threads don't mix very well. If you really need more threads, the best way would be to send some messages (containing user input informations) from the opengl thread to the thread where you do something with this information.

VJo
How can you capture input data with OpenGL?
erjot
I know how to do it for GLUT. For glut, you need to use glutMouseFunc and glutKeyboardFunc functions, and save all coordinates of the mouse clicks and whatever use types on the keyboard.
VJo
A: 

GLFW has good input API and you don't really need to process input in separate thread. If your framerate is high enough, checking input once per frame should be enough (if your frames are taking seconds to render, that may be not the case).

alxx
Putting input on separate thread certainly is not for performance tunning. :) As I came closer to the problem I realized it's not good idea to do so.
erjot