Uploading spaceball/set-window patch per e-mail from John Tsiombikas dated 1:34 PM...
[freeglut] / src / freeglut_init.c
index d602a71..5161c03 100644 (file)
@@ -25,6 +25,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#define FREEGLUT_BUILDING_LIB
 #include <GL/freeglut.h>
 #include "freeglut_internal.h"
 
@@ -84,8 +85,12 @@ SFG_State fgState = { { -1, -1, GL_FALSE },  /* Position */
                       NULL,                   /* ProgramName */
                       GL_FALSE,               /* JoysticksInitialised */
                       GL_FALSE,               /* InputDevsInitialised */
-                      0,                      /* AuxiliaryBufferNumber */
-                      0                       /* SampleNumber */
+                      1,                      /* AuxiliaryBufferNumber */
+                      4,                      /* SampleNumber */
+                      1,                      /* MajorVersion */
+                      0,                      /* MajorVersion */
+                      0,                      /* ContextFlags */
+                      0                       /* ContextProfile */
 };
 
 
@@ -418,6 +423,11 @@ void fgDeinitialize( void )
     fgState.JoysticksInitialised = GL_FALSE;
     fgState.InputDevsInitialised = GL_FALSE;
 
+    fgState.MajorVersion = 1;
+    fgState.MinorVersion = 0;
+    fgState.ContextFlags = 0;
+    fgState.ContextProfile = 0;
+
     fgState.Initialised = GL_FALSE;
 
     fgState.Position.X = -1;
@@ -690,6 +700,7 @@ void FGAPIENTRY glutInit( int* pargc, char** argv )
 #ifndef _WIN32_WCE
     {
         const char *fps = getenv( "GLUT_FPS" );
+
         if( fps )
         {
             int interval;
@@ -702,7 +713,7 @@ void FGAPIENTRY glutInit( int* pargc, char** argv )
         }
     }
 
-    displayName = getenv( "DISPLAY");
+    displayName = getenv( "DISPLAY" );
 
     for( i = 1; i < argc; i++ )
     {
@@ -817,6 +828,16 @@ void FGAPIENTRY glutInit( int* pargc, char** argv )
     }
 }
 
+#if TARGET_HOST_MS_WINDOWS
+void (__cdecl *__glutExitFunc)( int return_value ) = NULL;
+
+void FGAPIENTRY __glutInitWithExit( int *pargc, char **argv, void (__cdecl *exit_function)(int) )
+{
+  __glutExitFunc = exit_function;
+  glutInit(pargc, argv);
+}
+#endif
+
 /*
  * Undoes all the "glutInit" stuff
  */
@@ -891,6 +912,7 @@ void FGAPIENTRY glutInitDisplayString( const char* displayMode )
     buffer[len] = '\0';
 
     token = strtok ( buffer, " \t" );
+
     while ( token )
     {
         /* Process this token */
@@ -1076,4 +1098,26 @@ void FGAPIENTRY glutInitDisplayString( const char* displayMode )
     fgState.DisplayMode = glut_state_flag;
 }
 
+/* -- SETTING OPENGL 3.0 CONTEXT CREATION PARAMETERS ---------------------- */
+
+void FGAPIENTRY glutInitContextVersion( int majorVersion, int minorVersion )
+{
+    /* We will make use of these valuse when creating a new OpenGL context... */
+    fgState.MajorVersion = majorVersion;
+    fgState.MinorVersion = minorVersion;
+}
+
+
+void FGAPIENTRY glutInitContextFlags( int flags )
+{
+    /* We will make use of this value when creating a new OpenGL context... */
+    fgState.ContextFlags = flags;
+}
+
+void FGAPIENTRY glutInitContextProfile( int profile )
+{
+    /* We will make use of this value when creating a new OpenGL context... */
+    fgState.ContextProfile = profile;
+}
+
 /*** END OF FILE ***/