Part one of fixing bug 3058987 -- the 'freeglut_patch_visual_info.diff' changes
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@884 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
62dc997e85
commit
707dedd131
@ -825,7 +825,7 @@ void fgDestroyStructure( void );
|
||||
|
||||
/* A helper function to check if a display mode is possible to use */
|
||||
#if TARGET_HOST_POSIX_X11
|
||||
GLXFBConfig* fgChooseFBConfig( void );
|
||||
GLXFBConfig* fgChooseFBConfig( int* numcfgs );
|
||||
#endif
|
||||
|
||||
/* The window procedure for Win32 events handling */
|
||||
|
@ -320,7 +320,7 @@ int FGAPIENTRY glutGet( GLenum eWhat )
|
||||
GLXFBConfig * fbconfig;
|
||||
int isPossible;
|
||||
|
||||
fbconfig = fgChooseFBConfig();
|
||||
fbconfig = fgChooseFBConfig(NULL);
|
||||
|
||||
if (fbconfig == NULL)
|
||||
{
|
||||
|
@ -220,7 +220,7 @@ static void fghContextCreationError( void )
|
||||
* Chooses a visual basing on the current display mode settings
|
||||
*/
|
||||
|
||||
GLXFBConfig* fgChooseFBConfig( void )
|
||||
GLXFBConfig* fgChooseFBConfig( int *numcfgs )
|
||||
{
|
||||
GLboolean wantIndexedMode = GL_FALSE;
|
||||
int attributes[ 100 ];
|
||||
@ -385,6 +385,9 @@ GLXFBConfig* fgChooseFBConfig( void )
|
||||
fbconfig = NULL;
|
||||
}
|
||||
|
||||
if (numcfgs)
|
||||
*numcfgs = fbconfigArraySize;
|
||||
|
||||
return fbconfig;
|
||||
}
|
||||
}
|
||||
@ -904,13 +907,14 @@ void fgOpenWindow( SFG_Window* window, const char* title,
|
||||
XSizeHints sizeHints;
|
||||
XWMHints wmHints;
|
||||
unsigned long mask;
|
||||
int num_FBConfigs, i;
|
||||
unsigned int current_DisplayMode = fgState.DisplayMode ;
|
||||
|
||||
/* Save the display mode if we are creating a menu window */
|
||||
if( window->IsMenu && ( ! fgStructure.MenuContext ) )
|
||||
fgState.DisplayMode = GLUT_DOUBLE | GLUT_RGB ;
|
||||
|
||||
window->Window.FBConfig = fgChooseFBConfig( );
|
||||
window->Window.FBConfig = fgChooseFBConfig( &num_FBConfigs );
|
||||
|
||||
if( window->IsMenu && ( ! fgStructure.MenuContext ) )
|
||||
fgState.DisplayMode = current_DisplayMode ;
|
||||
@ -925,14 +929,14 @@ void fgOpenWindow( SFG_Window* window, const char* title,
|
||||
if( !( fgState.DisplayMode & GLUT_DOUBLE ) )
|
||||
{
|
||||
fgState.DisplayMode |= GLUT_DOUBLE ;
|
||||
window->Window.FBConfig = fgChooseFBConfig( );
|
||||
window->Window.FBConfig = fgChooseFBConfig( &num_FBConfigs );
|
||||
fgState.DisplayMode &= ~GLUT_DOUBLE;
|
||||
}
|
||||
|
||||
if( fgState.DisplayMode & GLUT_MULTISAMPLE )
|
||||
{
|
||||
fgState.DisplayMode &= ~GLUT_MULTISAMPLE ;
|
||||
window->Window.FBConfig = fgChooseFBConfig( );
|
||||
window->Window.FBConfig = fgChooseFBConfig( &num_FBConfigs );
|
||||
fgState.DisplayMode |= GLUT_MULTISAMPLE;
|
||||
}
|
||||
}
|
||||
@ -941,8 +945,15 @@ void fgOpenWindow( SFG_Window* window, const char* title,
|
||||
"FBConfig with necessary capabilities not found", "fgOpenWindow" );
|
||||
|
||||
/* Get the X visual. */
|
||||
for (i = 0; i < num_FBConfigs; i++) {
|
||||
visualInfo = glXGetVisualFromFBConfig( fgDisplay.Display,
|
||||
*(window->Window.FBConfig) );
|
||||
window->Window.FBConfig[i] );
|
||||
if (visualInfo)
|
||||
break;
|
||||
}
|
||||
|
||||
FREEGLUT_INTERNAL_ERROR_EXIT( visualInfo != NULL,
|
||||
"visualInfo could not be retrieved from FBConfig", "fgOpenWindow" );
|
||||
|
||||
/*
|
||||
* XXX HINT: the masks should be updated when adding/removing callbacks.
|
||||
|
Reference in New Issue
Block a user