+ "alpha", "acca", "acc", "blue", "buffer", "conformant", "depth", "double", "green",
+ "index", "num", "red", "rgba", "rgb", "luminance", "stencil", "single", "stereo", "samples",
+ "slow", "win32pdf", "xvisual", "xstaticgray", "xgrayscale", "xstaticcolor", "xpseudocolor",
+ "xtruecolor", "xdirectcolor"
+};
+
+static int TokenLengths[] =
+{
+ 5, 4, 3, 4, 6, 10, 5, 6, 5,
+ 5, 3, 3, 4, 3, 9, 7, 6, 6, 7,
+ 4, 8, 7, 11, 10, 12, 12,
+ 10, 12
+};
+
+void FGAPIENTRY glutInitDisplayString( const char* displayMode )
+{
+ int glut_state_flag = 0 ;
+ /*
+ * Unpack a lot of options from a character string. The options are delimited by blanks or tabs.
+ */
+ char *token ;
+ int len = strlen ( displayMode ) ;
+ char *buffer = malloc ( (len+1) * sizeof(char) ) ;
+ memcpy ( buffer, displayMode, len ) ;
+ buffer[len] = '\0' ;
+
+ token = strtok ( buffer, " \t" ) ;
+ while ( token )
+ {
+ /*
+ * Process this token
+ */
+ int i ;
+ for ( i = 0; i < NUM_TOKENS; i++ )
+ {
+ if ( strncmp ( token, Tokens[i], TokenLengths[i] ) == 0 ) break ;
+ }
+
+ switch ( i )
+ {
+ case 0 : /* "alpha": Alpha color buffer precision in bits */
+ glut_state_flag |= GLUT_ALPHA ; /* Somebody fix this for me! */
+ break ;
+
+ case 1 : /* "acca": Red, green, blue, and alpha accumulation buffer precision in bits */
+ break ;
+
+ case 2 : /* "acc": Red, green, and blue accumulation buffer precision in bits with zero bits alpha */
+ glut_state_flag |= GLUT_ACCUM ; /* Somebody fix this for me! */
+ break ;
+
+ case 3 : /* "blue": Blue color buffer precision in bits */
+ break ;
+
+ case 4 : /* "buffer": Number of bits in the color index color buffer */
+ break ;
+
+ case 5 : /* "conformant": Boolean indicating if the frame buffer configuration is conformant or not */
+ break ;
+
+ case 6 : /* "depth": Number of bits of precsion in the depth buffer */
+ glut_state_flag |= GLUT_DEPTH ; /* Somebody fix this for me! */
+ break ;
+
+ case 7 : /* "double": Boolean indicating if the color buffer is double buffered */
+ glut_state_flag |= GLUT_DOUBLE ;
+ break ;
+
+ case 8 : /* "green": Green color buffer precision in bits */
+ break ;
+
+ case 9 : /* "index": Boolean if the color model is color index or not */
+ glut_state_flag |= GLUT_INDEX ;
+ break ;
+
+ case 10 : /* "num": A special capability name indicating where the value represents the Nth frame buffer configuration matching the description string */
+ break ;
+
+ case 11 : /* "red": Red color buffer precision in bits */
+ break ;
+
+ case 12 : /* "rgba": Number of bits of red, green, blue, and alpha in the RGBA color buffer */
+ glut_state_flag |= GLUT_RGBA ; /* Somebody fix this for me! */
+ break ;
+
+ case 13 : /* "rgb": Number of bits of red, green, and blue in the RGBA color buffer with zero bits alpha */
+ glut_state_flag |= GLUT_RGB ; /* Somebody fix this for me! */
+ break ;
+
+ case 14 : /* "luminance": Number of bits of red in the RGBA and zero bits of green, blue (alpha not specified) of color buffer precision */
+ glut_state_flag |= GLUT_LUMINANCE ; /* Somebody fix this for me! */
+ break ;
+
+ case 15 : /* "stencil": Number of bits in the stencil buffer */
+ glut_state_flag |= GLUT_STENCIL ; /* Somebody fix this for me! */
+ break ;
+
+ case 16 : /* "single": Boolean indicate the color buffer is single buffered */
+ glut_state_flag |= GLUT_SINGLE ;
+ break ;
+
+ case 17 : /* "stereo": Boolean indicating the color buffer supports OpenGL-style stereo */
+ glut_state_flag |= GLUT_STEREO ;
+ break ;
+
+ case 18 : /* "samples": Indicates the number of multisamples to use based on GLX's SGIS_multisample extension (for antialiasing) */
+ glut_state_flag |= GLUT_MULTISAMPLE ; /* Somebody fix this for me! */
+ break ;
+
+ case 19 : /* "slow": Boolean indicating if the frame buffer configuration is slow or not */
+ break ;
+
+ case 20 : /* "win32pdf": matches the Win32 Pixel Format Descriptor by number */
+#ifdef TARGET_HOST_WIN32
+#endif
+ break ;
+
+ case 21 : /* "xvisual": matches the X visual ID by number */
+#ifdef TARGET_HOST_UNIX_X11
+#endif
+ break ;
+
+ case 22 : /* "xstaticgray": boolean indicating if the frame buffer configuration's X visual is of type StaticGray */
+#ifdef TARGET_HOST_UNIX_X11
+#endif
+ break ;
+
+ case 23 : /* "xgrayscale": boolean indicating if the frame buffer configuration's X visual is of type GrayScale */
+#ifdef TARGET_HOST_UNIX_X11
+#endif
+ break ;
+
+ case 24 : /* "xstaticcolor": boolean indicating if the frame buffer configuration's X visual is of type StaticColor */
+#ifdef TARGET_HOST_UNIX_X11
+#endif
+ break ;
+
+ case 25 : /* "xpseudocolor": boolean indicating if the frame buffer configuration's X visual is of type PseudoColor */
+#ifdef TARGET_HOST_UNIX_X11
+#endif
+ break ;
+
+ case 26 : /* "xtruecolor": boolean indicating if the frame buffer configuration's X visual is of type TrueColor */
+#ifdef TARGET_HOST_UNIX_X11
+#endif
+ break ;
+
+ case 27 : /* "xdirectcolor": boolean indicating if the frame buffer configuration's X visual is of type DirectColor */
+#ifdef TARGET_HOST_UNIX_X11
+#endif
+ break ;
+
+ case 28 : /* Unrecognized */
+ printf ( "WARNING - Display string token not recognized: %s\n", token ) ;
+ break ;
+ }
+
+ token = strtok ( NULL, " \t" ) ;
+ }
+
+ free ( buffer ) ;
+
+ /*
+ * We will make use of this value when creating a new OpenGL context...
+ */
+ fgState.DisplayMode = glut_state_flag;