John Fay: Implement the modified logic of the direct/indirect rendering context.
[freeglut] / src / freeglut_init.c
index 6b69f9b..ec5b619 100644 (file)
@@ -59,8 +59,7 @@ SFG_State fgState = { { -1, -1, GL_FALSE },  /* Position */
                       { 300, 300, GL_TRUE }, /* Size */
                       GLUT_RGBA | GLUT_SINGLE | GLUT_DEPTH,  /* DisplayMode */
                       GL_FALSE,              /* Initialised */
-                      GL_FALSE,              /* ForceDirectContext */
-                      GL_TRUE,               /* TryDirectContext */
+                      GLUT_TRY_DIRECT_CONTEXT,  /* DirectContext */
                       GL_FALSE,              /* ForceIconic */
                       GL_FALSE,              /* UseCurrentContext */
                       GL_FALSE,              /* GLDebugSwitch */
@@ -176,7 +175,7 @@ void fgInitialize( const char* displayName )
         wc.style          = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
         if (!wc.hIcon)
           wc.hIcon        = LoadIcon( NULL, IDI_WINLOGO );
-#else //TARGET_HOST_WINCE
+#else /* TARGET_HOST_WINCE */
         wc.style          = CS_HREDRAW | CS_VREDRAW;
 #endif
 
@@ -213,7 +212,7 @@ void fgInitialize( const char* displayName )
 #if !TARGET_HOST_WINCE
     fgJoystickInit( 0 );
     fgJoystickInit( 1 );
-#endif //!TARGET_HOST_WINCE
+#endif /* !TARGET_HOST_WINCE */
 
     fgState.Initialised = GL_TRUE;
 }
@@ -259,7 +258,7 @@ void fgDeinitialize( void )
 
 #if !TARGET_HOST_WINCE
     fgJoystickClose( );
-#endif //!TARGET_HOST_WINCE
+#endif /* !TARGET_HOST_WINCE */
 
     fgState.Initialised = GL_FALSE;
 
@@ -273,8 +272,7 @@ void fgDeinitialize( void )
 
     fgState.DisplayMode = GLUT_RGBA | GLUT_SINGLE | GLUT_DEPTH;
 
-    fgState.ForceDirectContext  = GL_FALSE;
-    fgState.TryDirectContext    = GL_TRUE;
+    fgState.DirectContext  = GLUT_TRY_DIRECT_CONTEXT;
     fgState.ForceIconic         = GL_FALSE;
     fgState.UseCurrentContext   = GL_FALSE;
     fgState.GLDebugSwitch       = GL_FALSE;
@@ -570,21 +568,21 @@ void FGAPIENTRY glutInit( int* pargc, char** argv )
         }
         else if( strcmp( argv[ i ], "-direct" ) == 0)
         {
-            if( ! fgState.TryDirectContext )
+            if( fgState.DirectContext == GLUT_FORCE_INDIRECT_CONTEXT )
                 fgError( "parameters ambiguity, -direct and -indirect "
                     "cannot be both specified" );
 
-            fgState.ForceDirectContext = GL_TRUE;
+            fgState.DirectContext = GLUT_FORCE_DIRECT_CONTEXT;
             argv[ i ] = NULL;
             ( *pargc )--;
         }
         else if( strcmp( argv[ i ], "-indirect" ) == 0 )
         {
-            if( fgState.ForceDirectContext )
+            if( fgState.DirectContext == GLUT_FORCE_DIRECT_CONTEXT )
                 fgError( "parameters ambiguity, -direct and -indirect "
                     "cannot be both specified" );
 
-            fgState.TryDirectContext = GL_FALSE;
+            fgState.DirectContext = GLUT_FORCE_INDIRECT_CONTEXT;
             argv[ i ] = NULL;
             (*pargc)--;
         }
@@ -623,7 +621,7 @@ void FGAPIENTRY glutInit( int* pargc, char** argv )
         }
     }
 
-#endif //TARGET_HOST_WINCE
+#endif /* TARGET_HOST_WINCE */
 
     /*
      * Have the display created now. If there wasn't a "-display"