Hello, I am very new to coding with OpenGL and have a question regarding real-time interaction with glutMainLoop in C++.
I have a fully functional code that takes motion from a haptic device (robot) and displays it graphically using OpenGL. What I need to do is taken the positions of the device, send them via UDP to a server and resend them back to the client. The UDP coding isn’t a problem but I don’t know the nature of how glutMainLoop works and how I can receive positions and transfer them while the program runs in its loop.
Originally posted by Overmind: It may be better to just make an extra thread for processing motion data.
Would this just be some code inserted into the source glutMainLoop function itself?
The rendering loop with glutMainLoop() is continuously listening user events and rendering the scene when the system is idle.
You may need global variables to store the current states, such as the position of the device. So, the rendering loop with glutMainLoop and your updating codes (UDP parts) can share the same variables.