Hi I have to use glutTimerFunc
in order to simulate day and night
I have a directional light source which shows the day, this light source then should be disabled for the night
kindly suggest
supposing your light is GL_LIGHT0 :
glutTimerFunc( 10000, &timerFunc, 0 );
// change every 10seconds
timerFunc( int value ) {
static bool daylight = true;
if( daylight )
glEnable(GL_LIGHT0);
else
glDisable(GL_LIGHT0);
daylight = !daylight;
/* rearm the timer */
glutTimerFunc( 10000, &timerFunc, 0 );
}