PDA

View Full Version : GLUT: Warning in EXEC: glutInit being called a sec



linlin
05-08-2009, 03:04 PM
I uses pthread_create(&THREAD_ID,NULL, startDisplay, NULL) to create a thread for running my OpenGL where startDisplay() is a function that calls glutInit(), glutCreateWindow etc.

When I kill my thread by calling pthread_cancel(THREAD_ID) and call pthread_create((&THREAD_ID,NULL, startDisplay, NULL) again, glutInit() gave me "GLUT: Warning in EXEC: glutInit being called a second time".

I searched the glutInit.cpp and found the following code:

void glutInit(int *argcp, char **argv) {
char *str, *geometry = NULL;
int i;

if (gState.display) {
__glutWarning("glutInit being called a second time.");
return;
}

Is there anyway that I can set gStat.display to false in our application when I re-create the pthread? If yes, how to do it?

Basically, I am asking how to get rid of "glutInit being called a second time." so that I can bring up a new thread to run my OpenGL window again?

Thanks a lot for your help in advance !!!!!

Lynn