开发者

Playing with OpenGL and input from separate threads

开发者 https://www.devze.com 2023-01-19 09:02 出处:网络
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 th

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.


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).


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号