GLUTDisplay Loop: Updating display with a function from outside the main thread

Hi,

I’m working on a project, where the positions of objects in the OptiX scene get updated by a function in a certain interval. Unfortunately the update gets stucked when the display loop starts with GLUTDisplay::run() because the main thread locks into the display loop. I searched for a possibility to unlock the main thread using e.g. freeglut, but that doesn’t helped, because it would terminate my window, if I exit the display loop.
Is it possible to move the GLUT Display Loop into a separate thread, so that the main thread doesn’t get locked and the update function can get called in my desired interval? I also found out that one can use the glutdisplay idle function to retrieve data from outside. Is it possible to edit the idle function in GLUTDisplay.cpp to do that?

Greetings

Michael

Ok I tried to get my display loop into a seperate thread and it works!

I implemented a std::thread which contains the display loop. Now I can use my function to update the positions of the scene in my desired interval, because the update function returns back again.

void createDisplay(void* sensor, int argc, char** argv){
	SimpleOptixScene* scene = static_cast<SimpleOptixScene*> (sensor);
	AccelDescriptor accel_desc;
	GLUTDisplay::setAccelDescriptor(accel_desc);
	try {
		GLUTDisplay::init(argc, argv);
		GLUTDisplay::run( "window", scene, GLUTDisplay::CDNone );
	} catch( Exception& e ){
		sutilReportError( e.getErrorString().c_str() );
	    exit(1);
	}
}