How do I integrate my network and OpenGL code?
14:33 10 Oct 2009

For networking code integrated with OpenGL I need to send position coordinates over a network so OpenGL would draw the object at the correct position.

A loop constantly updates/draws. I thought I could have the UDP code in a separate thread and just update the shared coordinates. However, if my draw functions read a position before the network code is done writing I have a race condition and invalid data.

I can't make the update- or draw loops block and am not sure if I should be using synchronous or asynchronous networking code. How can I solve this?

multithreading opengl boost network-programming