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 */
|
/* A helper function to check if a display mode is possible to use */
|
||||||
#if TARGET_HOST_POSIX_X11
|
#if TARGET_HOST_POSIX_X11
|
||||||
GLXFBConfig* fgChooseFBConfig( void );
|
GLXFBConfig* fgChooseFBConfig( int* numcfgs );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The window procedure for Win32 events handling */
|
/* The window procedure for Win32 events handling */
|
||||||
|
@ -320,7 +320,7 @@ int FGAPIENTRY glutGet( GLenum eWhat )
|
|||||||
GLXFBConfig * fbconfig;
|
GLXFBConfig * fbconfig;
|
||||||
int isPossible;
|
int isPossible;
|
||||||
|
|
||||||
fbconfig = fgChooseFBConfig();
|
fbconfig = fgChooseFBConfig(NULL);
|
||||||
|
|
||||||
if (fbconfig == NULL)
|
if (fbconfig == NULL)
|
||||||
{
|
{
|
||||||
|
@ -220,7 +220,7 @@ static void fghContextCreationError( void )
|
|||||||
* Chooses a visual basing on the current display mode settings
|
* Chooses a visual basing on the current display mode settings
|
||||||
*/
|
*/
|
||||||
|
|
||||||
GLXFBConfig* fgChooseFBConfig( void )
|
GLXFBConfig* fgChooseFBConfig( int *numcfgs )
|
||||||
{
|
{
|
||||||
GLboolean wantIndexedMode = GL_FALSE;
|
GLboolean wantIndexedMode = GL_FALSE;
|
||||||
int attributes[ 100 ];
|
int attributes[ 100 ];
|
||||||
@ -385,6 +385,9 @@ GLXFBConfig* fgChooseFBConfig( void )
|
|||||||
fbconfig = NULL;
|
fbconfig = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (numcfgs)
|
||||||
|
*numcfgs = fbconfigArraySize;
|
||||||
|
|
||||||
return fbconfig;
|
return fbconfig;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -904,13 +907,14 @@ void fgOpenWindow( SFG_Window* window, const char* title,
|
|||||||
XSizeHints sizeHints;
|
XSizeHints sizeHints;
|
||||||
XWMHints wmHints;
|
XWMHints wmHints;
|
||||||
unsigned long mask;
|
unsigned long mask;
|
||||||
|
int num_FBConfigs, i;
|
||||||
unsigned int current_DisplayMode = fgState.DisplayMode ;
|
unsigned int current_DisplayMode = fgState.DisplayMode ;
|
||||||
|
|
||||||
/* Save the display mode if we are creating a menu window */
|
/* Save the display mode if we are creating a menu window */
|
||||||
if( window->IsMenu && ( ! fgStructure.MenuContext ) )
|
if( window->IsMenu && ( ! fgStructure.MenuContext ) )
|
||||||
fgState.DisplayMode = GLUT_DOUBLE | GLUT_RGB ;
|
fgState.DisplayMode = GLUT_DOUBLE | GLUT_RGB ;
|
||||||
|
|
||||||
window->Window.FBConfig = fgChooseFBConfig( );
|
window->Window.FBConfig = fgChooseFBConfig( &num_FBConfigs );
|
||||||
|
|
||||||
if( window->IsMenu && ( ! fgStructure.MenuContext ) )
|
if( window->IsMenu && ( ! fgStructure.MenuContext ) )
|
||||||
fgState.DisplayMode = current_DisplayMode ;
|
fgState.DisplayMode = current_DisplayMode ;
|
||||||
@ -925,14 +929,14 @@ void fgOpenWindow( SFG_Window* window, const char* title,
|
|||||||
if( !( fgState.DisplayMode & GLUT_DOUBLE ) )
|
if( !( fgState.DisplayMode & GLUT_DOUBLE ) )
|
||||||
{
|
{
|
||||||
fgState.DisplayMode |= GLUT_DOUBLE ;
|
fgState.DisplayMode |= GLUT_DOUBLE ;
|
||||||
window->Window.FBConfig = fgChooseFBConfig( );
|
window->Window.FBConfig = fgChooseFBConfig( &num_FBConfigs );
|
||||||
fgState.DisplayMode &= ~GLUT_DOUBLE;
|
fgState.DisplayMode &= ~GLUT_DOUBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fgState.DisplayMode & GLUT_MULTISAMPLE )
|
if( fgState.DisplayMode & GLUT_MULTISAMPLE )
|
||||||
{
|
{
|
||||||
fgState.DisplayMode &= ~GLUT_MULTISAMPLE ;
|
fgState.DisplayMode &= ~GLUT_MULTISAMPLE ;
|
||||||
window->Window.FBConfig = fgChooseFBConfig( );
|
window->Window.FBConfig = fgChooseFBConfig( &num_FBConfigs );
|
||||||
fgState.DisplayMode |= GLUT_MULTISAMPLE;
|
fgState.DisplayMode |= GLUT_MULTISAMPLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -941,8 +945,15 @@ void fgOpenWindow( SFG_Window* window, const char* title,
|
|||||||
"FBConfig with necessary capabilities not found", "fgOpenWindow" );
|
"FBConfig with necessary capabilities not found", "fgOpenWindow" );
|
||||||
|
|
||||||
/* Get the X visual. */
|
/* Get the X visual. */
|
||||||
visualInfo = glXGetVisualFromFBConfig( fgDisplay.Display,
|
for (i = 0; i < num_FBConfigs; i++) {
|
||||||
*(window->Window.FBConfig) );
|
visualInfo = glXGetVisualFromFBConfig( fgDisplay.Display,
|
||||||
|
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.
|
* XXX HINT: the masks should be updated when adding/removing callbacks.
|
||||||
|
Reference in New Issue
Block a user