X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2FCommon%2Ffreeglut_state.c;h=8962df33764308b3de3fe6a599c392070fa4a336;hb=6c3c78f5fe46f0126e26dcae456ebdec502913f5;hp=4f2ce426fc76aa162306e9eb3cc0f94819e7c6db;hpb=d2f7ea29ea6d946f455f4363c3f058ff2bdfba35;p=freeglut diff --git a/src/Common/freeglut_state.c b/src/Common/freeglut_state.c index 4f2ce42..8962df3 100644 --- a/src/Common/freeglut_state.c +++ b/src/Common/freeglut_state.c @@ -41,6 +41,16 @@ * The fail-on-call policy will help adding the most needed things imho. */ +extern int fgPlatformGlutGet ( GLenum eWhat ); +extern int fgPlatformGlutDeviceGet ( GLenum eWhat ); +extern int fgPlatformGlutLayerGet ( GLenum eWhat ); + +/* A helper function to check if a display mode is possible to use */ +#if TARGET_HOST_POSIX_X11 +GLXFBConfig* fgChooseFBConfig( int* numcfgs ); +#endif + + /* -- LOCAL DEFINITIONS ---------------------------------------------------- */ /* -- PRIVATE FUNCTIONS ---------------------------------------------------- */ @@ -55,136 +65,20 @@ static int fghGetConfig( int attribute ) int result; /* Not checked */ if( fgStructure.CurrentWindow ) - result = glXGetFBConfigAttrib( fgDisplay.Display, - *(fgStructure.CurrentWindow->Window.FBConfig), + result = glXGetFBConfigAttrib( fgDisplay.pDisplay.Display, + *(fgStructure.CurrentWindow->Window.pContext.FBConfig), attribute, &returnValue ); return returnValue; } -#endif - -/* -- INTERFACE FUNCTIONS -------------------------------------------------- */ - -/* - * General settings assignment method - */ -void FGAPIENTRY glutSetOption( GLenum eWhat, int value ) -{ - FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSetOption" ); - - /* - * XXX In chronological code add order. (WHY in that order?) - */ - switch( eWhat ) - { - case GLUT_INIT_WINDOW_X: - fgState.Position.X = (GLint)value; - break; - - case GLUT_INIT_WINDOW_Y: - fgState.Position.Y = (GLint)value; - break; - - case GLUT_INIT_WINDOW_WIDTH: - fgState.Size.X = (GLint)value; - break; - - case GLUT_INIT_WINDOW_HEIGHT: - fgState.Size.Y = (GLint)value; - break; - - case GLUT_INIT_DISPLAY_MODE: - fgState.DisplayMode = (unsigned int)value; - break; - - case GLUT_ACTION_ON_WINDOW_CLOSE: - fgState.ActionOnWindowClose = value; - break; - - case GLUT_RENDERING_CONTEXT: - fgState.UseCurrentContext = - ( value == GLUT_USE_CURRENT_CONTEXT ) ? GL_TRUE : GL_FALSE; - break; - - case GLUT_DIRECT_RENDERING: - fgState.DirectContext = value; - break; - - case GLUT_WINDOW_CURSOR: - if( fgStructure.CurrentWindow != NULL ) - fgStructure.CurrentWindow->State.Cursor = value; - break; - - case GLUT_AUX: - fgState.AuxiliaryBufferNumber = value; - break; - - case GLUT_MULTISAMPLE: - fgState.SampleNumber = value; - break; - - default: - fgWarning( "glutSetOption(): missing enum handle %d", eWhat ); - break; - } -} - -#if TARGET_HOST_MS_WINDOWS -/* The following include file is available from SGI but is not standard: - * #include - * So we copy the necessary parts out of it to support the multisampling query - */ -#define WGL_SAMPLES_ARB 0x2042 -#endif - -/* - * General settings query method - */ -int FGAPIENTRY glutGet( GLenum eWhat ) +int fgPlatformGlutGet ( GLenum eWhat ) { -#if TARGET_HOST_MS_WINDOWS - int returnValue ; - GLboolean boolValue ; -#endif - int nsamples = 0; - switch (eWhat) - { - case GLUT_INIT_STATE: - return fgState.Initialised; - - case GLUT_ELAPSED_TIME: - return fgElapsedTime(); - } - - FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGet" ); - - /* XXX In chronological code add order. (WHY in that order?) */ switch( eWhat ) { - /* Following values are stored in fgState and fgDisplay global structures */ - case GLUT_SCREEN_WIDTH: return fgDisplay.ScreenWidth ; - case GLUT_SCREEN_HEIGHT: return fgDisplay.ScreenHeight ; - case GLUT_SCREEN_WIDTH_MM: return fgDisplay.ScreenWidthMM ; - case GLUT_SCREEN_HEIGHT_MM: return fgDisplay.ScreenHeightMM; - case GLUT_INIT_WINDOW_X: return fgState.Position.Use ? - fgState.Position.X : -1 ; - case GLUT_INIT_WINDOW_Y: return fgState.Position.Use ? - fgState.Position.Y : -1 ; - case GLUT_INIT_WINDOW_WIDTH: return fgState.Size.Use ? - fgState.Size.X : -1 ; - case GLUT_INIT_WINDOW_HEIGHT: return fgState.Size.Use ? - fgState.Size.Y : -1 ; - case GLUT_INIT_DISPLAY_MODE: return fgState.DisplayMode ; - case GLUT_INIT_MAJOR_VERSION: return fgState.MajorVersion ; - case GLUT_INIT_MINOR_VERSION: return fgState.MinorVersion ; - case GLUT_INIT_FLAGS: return fgState.ContextFlags ; - case GLUT_INIT_PROFILE: return fgState.ContextProfile ; - -#if TARGET_HOST_POSIX_X11 /* * The window/context specific queries are handled mostly by * fghGetConfig(). @@ -231,10 +125,10 @@ int FGAPIENTRY glutGet( GLenum eWhat ) else { const GLXFBConfig * fbconfig = - fgStructure.CurrentWindow->Window.FBConfig; + fgStructure.CurrentWindow->Window.pContext.FBConfig; XVisualInfo * visualInfo = - glXGetVisualFromFBConfig( fgDisplay.Display, *fbconfig ); + glXGetVisualFromFBConfig( fgDisplay.pDisplay.Display, *fbconfig ); const int result = visualInfo->visual->map_entries; @@ -259,7 +153,7 @@ int FGAPIENTRY glutGet( GLenum eWhat ) return 0; XTranslateCoordinates( - fgDisplay.Display, + fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle, fgDisplay.RootWindow, 0, 0, &x, &y, &w); @@ -273,7 +167,7 @@ int FGAPIENTRY glutGet( GLenum eWhat ) if ( w == 0 ) return 0; XTranslateCoordinates( - fgDisplay.Display, + fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle, w, 0, 0, &x, &y, &w); @@ -292,7 +186,7 @@ int FGAPIENTRY glutGet( GLenum eWhat ) if( fgStructure.CurrentWindow == NULL ) return 0; XGetWindowAttributes( - fgDisplay.Display, + fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle, &winAttributes ); @@ -332,185 +226,203 @@ int FGAPIENTRY glutGet( GLenum eWhat ) return fghGetConfig( GLX_VISUAL_ID ); -#elif TARGET_HOST_MS_WINDOWS + default: + fgWarning( "glutGet(): missing enum handle %d", eWhat ); + break; + } +} - case GLUT_WINDOW_NUM_SAMPLES: - glGetIntegerv(WGL_SAMPLES_ARB, &nsamples); - return nsamples; - - /* Handle the OpenGL inquiries */ - case GLUT_WINDOW_RGBA: -#if defined(_WIN32_WCE) - boolValue = (GLboolean)0; /* WinCE doesn't support this feature */ -#else - glGetBooleanv ( GL_RGBA_MODE, &boolValue ); - returnValue = boolValue ? 1 : 0; -#endif - return returnValue; - case GLUT_WINDOW_DOUBLEBUFFER: -#if defined(_WIN32_WCE) - boolValue = (GLboolean)0; /* WinCE doesn't support this feature */ -#else - glGetBooleanv ( GL_DOUBLEBUFFER, &boolValue ); - returnValue = boolValue ? 1 : 0; -#endif - return returnValue; - case GLUT_WINDOW_STEREO: -#if defined(_WIN32_WCE) - boolValue = (GLboolean)0; /* WinCE doesn't support this feature */ -#else - glGetBooleanv ( GL_STEREO, &boolValue ); - returnValue = boolValue ? 1 : 0; -#endif - return returnValue; - - case GLUT_WINDOW_RED_SIZE: - glGetIntegerv ( GL_RED_BITS, &returnValue ); - return returnValue; - case GLUT_WINDOW_GREEN_SIZE: - glGetIntegerv ( GL_GREEN_BITS, &returnValue ); - return returnValue; - case GLUT_WINDOW_BLUE_SIZE: - glGetIntegerv ( GL_BLUE_BITS, &returnValue ); - return returnValue; - case GLUT_WINDOW_ALPHA_SIZE: - glGetIntegerv ( GL_ALPHA_BITS, &returnValue ); - return returnValue; - case GLUT_WINDOW_ACCUM_RED_SIZE: -#if defined(_WIN32_WCE) - returnValue = 0; /* WinCE doesn't support this feature */ -#else - glGetIntegerv ( GL_ACCUM_RED_BITS, &returnValue ); -#endif - return returnValue; - case GLUT_WINDOW_ACCUM_GREEN_SIZE: -#if defined(_WIN32_WCE) - returnValue = 0; /* WinCE doesn't support this feature */ -#else - glGetIntegerv ( GL_ACCUM_GREEN_BITS, &returnValue ); -#endif - return returnValue; - case GLUT_WINDOW_ACCUM_BLUE_SIZE: -#if defined(_WIN32_WCE) - returnValue = 0; /* WinCE doesn't support this feature */ -#else - glGetIntegerv ( GL_ACCUM_BLUE_BITS, &returnValue ); -#endif - return returnValue; - case GLUT_WINDOW_ACCUM_ALPHA_SIZE: -#if defined(_WIN32_WCE) - returnValue = 0; /* WinCE doesn't support this feature */ -#else - glGetIntegerv ( GL_ACCUM_ALPHA_BITS, &returnValue ); -#endif - return returnValue; - case GLUT_WINDOW_DEPTH_SIZE: - glGetIntegerv ( GL_DEPTH_BITS, &returnValue ); - return returnValue; - - case GLUT_WINDOW_BUFFER_SIZE: - returnValue = 1 ; /* ????? */ - return returnValue; - case GLUT_WINDOW_STENCIL_SIZE: - returnValue = 0 ; /* ????? */ - return returnValue; - case GLUT_WINDOW_X: - case GLUT_WINDOW_Y: - case GLUT_WINDOW_WIDTH: - case GLUT_WINDOW_HEIGHT: +int fgPlatformGlutDeviceGet ( GLenum eWhat ) +{ + switch( eWhat ) { + case GLUT_HAS_KEYBOARD: /* - * There is considerable confusion about the "right thing to - * do" concerning window size and position. GLUT itself is - * not consistent between Windows and UNIX/X11; since - * platform independence is a virtue for "freeglut", we - * decided to break with GLUT's behaviour. - * - * Under UNIX/X11, it is apparently not possible to get the - * window border sizes in order to subtract them off the - * window's initial position until some time after the window - * has been created. Therefore we decided on the following - * behaviour, both under Windows and under UNIX/X11: - * - When you create a window with position (x,y) and size - * (w,h), the upper left hand corner of the outside of the - * window is at (x,y) and the size of the drawable area is - * (w,h). - * - When you query the size and position of the window--as - * is happening here for Windows--"freeglut" will return - * the size of the drawable area--the (w,h) that you - * specified when you created the window--and the coordinates - * of the upper left hand corner of the drawable - * area--which is NOT the (x,y) you specified. + * X11 has a core keyboard by definition, although it can + * be present as a virtual/dummy keyboard. For now, there + * is no reliable way to tell if a real keyboard is present. */ + return 1; - RECT winRect; - - freeglut_return_val_if_fail( fgStructure.CurrentWindow != NULL, 0 ); - -#if defined(_WIN32_WCE) - GetWindowRect( fgStructure.CurrentWindow->Window.Handle, &winRect ); -#else - winRect = fghGetClientArea(fgStructure.CurrentWindow, FALSE); -#endif /* defined(_WIN32_WCE) */ + /* X11 has a mouse by definition */ + case GLUT_HAS_MOUSE: + return 1 ; - switch( eWhat ) + case GLUT_NUM_MOUSE_BUTTONS: + /* We should be able to pass NULL when the last argument is zero, + * but at least one X server has a bug where this causes a segfault. + * + * In XFree86/Xorg servers, a mouse wheel is seen as two buttons + * rather than an Axis; "freeglut_main.c" expects this when + * checking for a wheel event. + */ { - case GLUT_WINDOW_X: return winRect.left ; - case GLUT_WINDOW_Y: return winRect.top ; - case GLUT_WINDOW_WIDTH: return winRect.right - winRect.left; - case GLUT_WINDOW_HEIGHT: return winRect.bottom - winRect.top; + unsigned char map; + int nbuttons = XGetPointerMapping(fgDisplay.pDisplay.Display, &map,0); + return nbuttons; } + + default: + fgWarning( "glutDeviceGet(): missing enum handle %d", eWhat ); + break; } - break; - case GLUT_WINDOW_BORDER_WIDTH : - case GLUT_WINDOW_HEADER_HEIGHT : -#if defined(_WIN32_WCE) + /* And now -- the failure. */ + return -1; +} + +int fgPlatformGlutLayerGet( GLenum eWhat ) +{ + /* + * This is easy as layers are not implemented ;-) + * + * XXX Can we merge the UNIX/X11 and WIN32 sections? Or + * XXX is overlay support planned? + */ + switch( eWhat ) + { + case GLUT_OVERLAY_POSSIBLE: return 0; -#else - { - DWORD windowStyle; - - if (fgStructure.CurrentWindow && fgStructure.CurrentWindow->Window.Handle) - windowStyle = GetWindowLong(fgStructure.CurrentWindow->Window.Handle, GWL_STYLE); - else - /* If no window, return sizes for a default window with title bar and border */ - windowStyle = WS_OVERLAPPEDWINDOW; - - switch( eWhat ) - { - case GLUT_WINDOW_BORDER_WIDTH: - { - int xBorderWidth, yBorderWidth; - fghGetBorderWidth(windowStyle, &xBorderWidth, &yBorderWidth); - return xBorderWidth; - } - case GLUT_WINDOW_HEADER_HEIGHT: - /* Need to query for WS_MAXIMIZEBOX to see if we have a title bar, the WS_CAPTION query is also true for a WS_DLGFRAME only... */ - return (windowStyle & WS_MAXIMIZEBOX)? GetSystemMetrics( SM_CYCAPTION ) : 0; - } - } -#endif /* defined(_WIN32_WCE) */ - case GLUT_DISPLAY_MODE_POSSIBLE: -#if defined(_WIN32_WCE) + case GLUT_LAYER_IN_USE: + return GLUT_NORMAL; + + case GLUT_HAS_OVERLAY: return 0; -#else - return fgSetupPixelFormat( fgStructure.CurrentWindow, GL_TRUE, - PFD_MAIN_PLANE ); -#endif /* defined(_WIN32_WCE) */ + case GLUT_TRANSPARENT_INDEX: + /* + * Return just anything, which is always defined as zero + * + * XXX HUH? + */ + return 0; - case GLUT_WINDOW_FORMAT_ID: -#if !defined(_WIN32_WCE) - if( fgStructure.CurrentWindow != NULL ) - return GetPixelFormat( fgStructure.CurrentWindow->Window.Device ); -#endif /* defined(_WIN32_WCE) */ + case GLUT_NORMAL_DAMAGED: + /* XXX Actually I do not know. Maybe. */ return 0; + case GLUT_OVERLAY_DAMAGED: + return -1; + + default: + fgWarning( "glutLayerGet(): missing enum handle %d", eWhat ); + break; + } + + /* And fail. That's good. Programs do love failing. */ + return -1; +} + + + #endif +/* -- INTERFACE FUNCTIONS -------------------------------------------------- */ + +/* + * General settings assignment method + */ +void FGAPIENTRY glutSetOption( GLenum eWhat, int value ) +{ + FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSetOption" ); + + /* + * XXX In chronological code add order. (WHY in that order?) + */ + switch( eWhat ) + { + case GLUT_INIT_WINDOW_X: + fgState.Position.X = (GLint)value; + break; + + case GLUT_INIT_WINDOW_Y: + fgState.Position.Y = (GLint)value; + break; + + case GLUT_INIT_WINDOW_WIDTH: + fgState.Size.X = (GLint)value; + break; + + case GLUT_INIT_WINDOW_HEIGHT: + fgState.Size.Y = (GLint)value; + break; + + case GLUT_INIT_DISPLAY_MODE: + fgState.DisplayMode = (unsigned int)value; + break; + + case GLUT_ACTION_ON_WINDOW_CLOSE: + fgState.ActionOnWindowClose = value; + break; + + case GLUT_RENDERING_CONTEXT: + fgState.UseCurrentContext = + ( value == GLUT_USE_CURRENT_CONTEXT ) ? GL_TRUE : GL_FALSE; + break; + + case GLUT_DIRECT_RENDERING: + fgState.DirectContext = value; + break; + + case GLUT_WINDOW_CURSOR: + if( fgStructure.CurrentWindow != NULL ) + fgStructure.CurrentWindow->State.Cursor = value; + break; + + case GLUT_AUX: + fgState.AuxiliaryBufferNumber = value; + break; + + case GLUT_MULTISAMPLE: + fgState.SampleNumber = value; + break; + + default: + fgWarning( "glutSetOption(): missing enum handle %d", eWhat ); + break; + } +} + +/* + * General settings query method + */ +int FGAPIENTRY glutGet( GLenum eWhat ) +{ + switch (eWhat) + { + case GLUT_INIT_STATE: + return fgState.Initialised; + + case GLUT_ELAPSED_TIME: + return fgElapsedTime(); + } + + FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGet" ); + + /* XXX In chronological code add order. (WHY in that order?) */ + switch( eWhat ) + { + /* Following values are stored in fgState and fgDisplay global structures */ + case GLUT_SCREEN_WIDTH: return fgDisplay.ScreenWidth ; + case GLUT_SCREEN_HEIGHT: return fgDisplay.ScreenHeight ; + case GLUT_SCREEN_WIDTH_MM: return fgDisplay.ScreenWidthMM ; + case GLUT_SCREEN_HEIGHT_MM: return fgDisplay.ScreenHeightMM; + case GLUT_INIT_WINDOW_X: return fgState.Position.Use ? + fgState.Position.X : -1 ; + case GLUT_INIT_WINDOW_Y: return fgState.Position.Use ? + fgState.Position.Y : -1 ; + case GLUT_INIT_WINDOW_WIDTH: return fgState.Size.Use ? + fgState.Size.X : -1 ; + case GLUT_INIT_WINDOW_HEIGHT: return fgState.Size.Use ? + fgState.Size.Y : -1 ; + case GLUT_INIT_DISPLAY_MODE: return fgState.DisplayMode ; + case GLUT_INIT_MAJOR_VERSION: return fgState.MajorVersion ; + case GLUT_INIT_MINOR_VERSION: return fgState.MinorVersion ; + case GLUT_INIT_FLAGS: return fgState.ContextFlags ; + case GLUT_INIT_PROFILE: return fgState.ContextProfile ; + /* The window structure queries */ case GLUT_WINDOW_PARENT: if( fgStructure.CurrentWindow == NULL ) return 0; @@ -555,7 +467,7 @@ int FGAPIENTRY glutGet( GLenum eWhat ) return fgState.SampleNumber; default: - fgWarning( "glutGet(): missing enum handle %d", eWhat ); + return fgPlatformGlutGet ( eWhat ); break; } return -1; @@ -571,61 +483,6 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat ) /* XXX WARNING: we are mostly lying in this function. */ switch( eWhat ) { - case GLUT_HAS_KEYBOARD: - /* - * Win32 is assumed a keyboard, and this cannot be queried, - * except for WindowsCE. - * - * X11 has a core keyboard by definition, although it can - * be present as a virtual/dummy keyboard. For now, there - * is no reliable way to tell if a real keyboard is present. - */ -#if defined(_WIN32_CE) - return ( GetKeyboardStatus() & KBDI_KEYBOARD_PRESENT ) ? 1 : 0; -# if FREEGLUT_LIB_PRAGMAS -# pragma comment (lib,"Kbdui.lib") -# endif - -#else - return 1; -#endif - -#if TARGET_HOST_POSIX_X11 - - /* X11 has a mouse by definition */ - case GLUT_HAS_MOUSE: - return 1 ; - - case GLUT_NUM_MOUSE_BUTTONS: - /* We should be able to pass NULL when the last argument is zero, - * but at least one X server has a bug where this causes a segfault. - * - * In XFree86/Xorg servers, a mouse wheel is seen as two buttons - * rather than an Axis; "freeglut_main.c" expects this when - * checking for a wheel event. - */ - { - unsigned char map; - int nbuttons = XGetPointerMapping(fgDisplay.Display, &map,0); - return nbuttons; - } - -#elif TARGET_HOST_MS_WINDOWS - - case GLUT_HAS_MOUSE: - /* - * MS Windows can be booted without a mouse. - */ - return GetSystemMetrics( SM_MOUSEPRESENT ); - - case GLUT_NUM_MOUSE_BUTTONS: -# if defined(_WIN32_WCE) - return 1; -# else - return GetSystemMetrics( SM_CMOUSEBUTTONS ); -# endif -#endif - case GLUT_HAS_JOYSTICK: return fgJoystickDetect (); @@ -671,8 +528,7 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat ) return fgState.KeyRepeat; default: - fgWarning( "glutDeviceGet(): missing enum handle %d", eWhat ); - break; + return fgPlatformGlutDeviceGet ( eWhat ); } /* And now -- the failure. */ @@ -710,64 +566,8 @@ int FGAPIENTRY glutLayerGet( GLenum eWhat ) switch( eWhat ) { -#if TARGET_HOST_POSIX_X11 - - case GLUT_OVERLAY_POSSIBLE: - return 0; - - case GLUT_LAYER_IN_USE: - return GLUT_NORMAL; - - case GLUT_HAS_OVERLAY: - return 0; - - case GLUT_TRANSPARENT_INDEX: - /* - * Return just anything, which is always defined as zero - * - * XXX HUH? - */ - return 0; - - case GLUT_NORMAL_DAMAGED: - /* XXX Actually I do not know. Maybe. */ - return 0; - - case GLUT_OVERLAY_DAMAGED: - return -1; - -#elif TARGET_HOST_MS_WINDOWS - - case GLUT_OVERLAY_POSSIBLE: -/* return fgSetupPixelFormat( fgStructure.CurrentWindow, GL_TRUE, - PFD_OVERLAY_PLANE ); */ - return 0 ; - - case GLUT_LAYER_IN_USE: - return GLUT_NORMAL; - - case GLUT_HAS_OVERLAY: - return 0; - - case GLUT_TRANSPARENT_INDEX: - /* - * Return just anything, which is always defined as zero - * - * XXX HUH? - */ - return 0; - - case GLUT_NORMAL_DAMAGED: - /* XXX Actually I do not know. Maybe. */ - return 0; - - case GLUT_OVERLAY_DAMAGED: - return -1; -#endif - default: - fgWarning( "glutLayerGet(): missing enum handle %d", eWhat ); - break; + return fgPlatformGlutLayerGet( eWhat ); } /* And fail. That's good. Programs do love failing. */ @@ -833,8 +633,8 @@ int * FGAPIENTRY glutGetModeValues(GLenum eWhat, int * size) break; } - fbconfigArray = glXChooseFBConfig(fgDisplay.Display, - fgDisplay.Screen, + fbconfigArray = glXChooseFBConfig(fgDisplay.pDisplay.Display, + fgDisplay.pDisplay.Screen, attributes, &fbconfigArraySize); @@ -852,7 +652,7 @@ int * FGAPIENTRY glutGetModeValues(GLenum eWhat, int * size) { int value; - result = glXGetFBConfigAttrib(fgDisplay.Display, + result = glXGetFBConfigAttrib(fgDisplay.pDisplay.Display, fbconfigArray[i], attribute_name, &value);