I need to get some data from a serial port while rendering some grafix with opengl if 开发者_C百科I create a thread to read from serial port in main and start it before calling the opengl loop will it still work? .the serial writes to global variables which only need to be read by the opengl loop.
D
You'll need to do the usual synchronization between the threads with respect to the shared variables. Beyond that it should be straightforward threading. The fact that you're doing OpenGL in one of the threads shouldn't make any significant difference.
精彩评论