X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;ds=inline;f=src%2Ffreeglut_init.c;h=70207e0932849768472dd1e53f4896c7b5f315bf;hb=df33277ecd0e20914a9cb3aa5bfc17e0023b3334;hp=26cb353b26ae18fb97c7d7e81f41a9115d598a59;hpb=e3acaaba9a521a397aac8fb433e1f790563fc5c8;p=freeglut diff --git a/src/freeglut_init.c b/src/freeglut_init.c index 26cb353..70207e0 100644 --- a/src/freeglut_init.c +++ b/src/freeglut_init.c @@ -58,6 +58,7 @@ SFG_Display fgDisplay; SFG_State fgState = { { -1, -1, FALSE }, /* Position */ { 300, 300, TRUE }, /* Size */ GLUT_RGBA | GLUT_SINGLE | GLUT_DEPTH, /* DisplayMode */ + FALSE, /* Initalized */ FALSE, /* ForceDirectContext */ TRUE, /* TryDirectContext */ FALSE, /* ForceIconic */ @@ -197,6 +198,8 @@ void fgInitialize( const char* displayName ) #endif fgJoystickInit( 0 ); + + fgState.Initalized = GL_TRUE; } /* @@ -206,13 +209,15 @@ void fgDeinitialize( void ) { SFG_Timer *timer; - if( !fgState.Time.Set ) + if( !fgState.Initalized ) { - fgWarning( "fgDeinitialize(): fgState.Timer is null => " - "no valid initialization has been performed" ); + fgWarning( "fgDeinitialize(): " + "no valid initialization has been performed" ); return; } + fgState.Initalized = GL_FALSE; + /* * If there was a menu created, destroy the rendering context */ @@ -312,17 +317,12 @@ void FGAPIENTRY glutInit( int* pargc, char** argv ) if( !fgState.ProgramName ) fgError ("Could not allocate space for the program's name."); - if( fgState.Time.Set ) + if( fgState.Initalized ) fgError( "illegal glutInit() reinitialization attemp" ); fgCreateStructure( ); -#if TARGET_HOST_UNIX_X11 - gettimeofday( &fgState.Time.Value, NULL ); -#elif TARGET_HOST_WIN32 - fgState.Time.Value = timeGetTime( ); -#endif - fgState.Time.Set = TRUE; + fgElapsedTime( ); /* check if GLUT_FPS env var is set */ {