PDA

View Full Version : glutDestroyWindow / glutTimerFunc



Hubert
07-23-2003, 04:26 AM
Hi,

I have a problem with the glutTimerFunc. I have a program that switches between some windows. It does that by destroying the subwindow and creating a whole new subwindow. This is working fine. I only discovered a side effect: The Timer becomes faster with every destroyed/switched window. It is really not a problem of any speeding value that is incremented. I have checked that.

The code of the creation of the subwindow is here:
void SubfensterErzeugen(void)
{
int subWindow = 0; //
if ( (iFenster > 0)
&& (iFenster != iMainFenster))
Fensters
glutDestroyWindow(iFenster);

switch( iModus )
{
case NORMAL:
glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH );
break;
case QUADBUFFERED:
glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STEREO );
break;
case REDGREEN:
glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_ACCUM );
break;
case STENCILDIVIDED:
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STENCIL );
break;
case VERTICALPARALLAX:
glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STEREO );
break;
default:
break;
}//switch

subWindow = glutCreateSubWindow(iMainFenster,0,0,windowWidth, windowHeight);

iFenster = subWindow;

glutDisplayFunc( RenderScene );

glutReshapeFunc(nfChangeSize);

glutTimerFunc( 15, nfTimer, 0 );

MenuErzeugen();

nfInit();
}