amoskoh
02-22-2005, 11:42 PM
I have some standalone C++ code that decides does some calculations and decide a dynamic flightpath of some airplanes.
What I would like to do is have those flightpaths displayed though opengl.
However, in my previous programming with OpenGL, I use the glutDisplayFunc and glutIdleFunc to display.
But how would I integrate my C++ code with the rendering code because my C++ code decides the coordinates of the code and passes it to my opengl code, but since rendering functions registerd through glutDisplayFunc and glutIdleFunc are always running.. how do I move program control to my program?
Ie I want to start rendering. then go back to my C++ code that does its own stuff and updates the coordinates whenever it wants to.
I suppose using shared data structures is a solution but.. that might involve mutexes since I add and delete new objects.. so that list has to be locked.
Right now a hack is to have my opengl code being called by my c++ code and in the display code, I ask for new coordinates every now and then.
But this will not be sufficient if I want to send data to 3 diff rendering codes that draw difff scenes.
So how can I better control the whole rendering process if I'm always stuck in the loop for the display and idle functions.
What I would like to do is have those flightpaths displayed though opengl.
However, in my previous programming with OpenGL, I use the glutDisplayFunc and glutIdleFunc to display.
But how would I integrate my C++ code with the rendering code because my C++ code decides the coordinates of the code and passes it to my opengl code, but since rendering functions registerd through glutDisplayFunc and glutIdleFunc are always running.. how do I move program control to my program?
Ie I want to start rendering. then go back to my C++ code that does its own stuff and updates the coordinates whenever it wants to.
I suppose using shared data structures is a solution but.. that might involve mutexes since I add and delete new objects.. so that list has to be locked.
Right now a hack is to have my opengl code being called by my c++ code and in the display code, I ask for new coordinates every now and then.
But this will not be sufficient if I want to send data to 3 diff rendering codes that draw difff scenes.
So how can I better control the whole rendering process if I'm always stuck in the loop for the display and idle functions.