function pipeline, and therefore we must make sure the context created for them
is not a core profile context. Previously if the user requested a core profile
context, this would apply to menu windows too, and they would appear black.
git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1855
7f0cb862-5218-0410-a997-
914c9d46530a
#define ATTRIB_VAL(a,v) {ATTRIB(a); ATTRIB(v);}
int fghMapBit( int mask, int from, int to );
-int fghIsLegacyContextRequested( void );
+int fghIsLegacyContextRequested( SFG_Window *win );
void fghContextCreationError( void );
int fghNumberOfAuxBuffersRequested( void );
/* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
-int fghIsLegacyContextRequested( void )
+int fghIsLegacyContextRequested( SFG_Window *win )
{
- return fgState.MajorVersion < 2 || (fgState.MajorVersion == 2 && fgState.MinorVersion <= 1);
+ int vmajor = fgState.MajorVersion;
+ int vminor = fgState.MinorVersion;
+ /* XXX: menu windows are drawn with the fixed function pipeline, therefore
+ * the context created for them can't be a modern core-profile context.
+ * Force the traditional context creation for menu windows.
+ */
+ return vmajor < 2 || (vmajor == 2 && vminor <= 1) || win->IsMenu;
}
int fghNumberOfAuxBuffersRequested( void )
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;
/* If nothing fancy has been required, leave the context as it is */
- if ( fghIsLegacyContextRequested() )
+ if ( fghIsLegacyContextRequested(window) )
{
return;
}
CreateContextAttribsProc createContextAttribs = (CreateContextAttribsProc) fgPlatformGetProcAddress( "glXCreateContextAttribsARB" );
/* glXCreateContextAttribsARB not found, yet the user has requested the new context creation */
- if ( !createContextAttribs && !fghIsLegacyContextRequested() ) {
+ if ( !createContextAttribs && !fghIsLegacyContextRequested(window) ) {
fgWarning( "OpenGL >2.1 context requested but glXCreateContextAttribsARB is not available! Falling back to legacy context creation" );
fgState.MajorVersion = 2;
fgState.MinorVersion = 1;
}
/* If nothing fancy has been required, simply use the old context creation GLX API entry */
- if ( fghIsLegacyContextRequested() || !createContextAttribs )
+ if ( fghIsLegacyContextRequested(window) || !createContextAttribs )
{
context = glXCreateNewContext( dpy, config, render_type, share_list, direct );
if ( context == NULL ) {