|
From: <jt...@us...> - 2019-09-25 10:08:20
|
Revision: 1855
http://sourceforge.net/p/freeglut/code/1855
Author: jtsiomb
Date: 2019-09-25 10:08:07 +0000 (Wed, 25 Sep 2019)
Log Message:
-----------
Fixed bug #252: menu windows are drawn with immediate mode and the fixed
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.
Modified Paths:
--------------
trunk/freeglut/freeglut/src/fg_internal.h
trunk/freeglut/freeglut/src/fg_window.c
trunk/freeglut/freeglut/src/mswin/fg_window_mswin.c
trunk/freeglut/freeglut/src/x11/fg_window_x11_glx.c
Modified: trunk/freeglut/freeglut/src/fg_internal.h
===================================================================
--- trunk/freeglut/freeglut/src/fg_internal.h 2019-09-18 11:58:31 UTC (rev 1854)
+++ trunk/freeglut/freeglut/src/fg_internal.h 2019-09-25 10:08:07 UTC (rev 1855)
@@ -1166,7 +1166,7 @@
#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 );
Modified: trunk/freeglut/freeglut/src/fg_window.c
===================================================================
--- trunk/freeglut/freeglut/src/fg_window.c 2019-09-18 11:58:31 UTC (rev 1854)
+++ trunk/freeglut/freeglut/src/fg_window.c 2019-09-25 10:08:07 UTC (rev 1855)
@@ -62,9 +62,15 @@
/* -- 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 )
Modified: trunk/freeglut/freeglut/src/mswin/fg_window_mswin.c
===================================================================
--- trunk/freeglut/freeglut/src/mswin/fg_window_mswin.c 2019-09-18 11:58:31 UTC (rev 1854)
+++ trunk/freeglut/freeglut/src/mswin/fg_window_mswin.c 2019-09-25 10:08:07 UTC (rev 1855)
@@ -145,7 +145,7 @@
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;
/* If nothing fancy has been required, leave the context as it is */
- if ( fghIsLegacyContextRequested() )
+ if ( fghIsLegacyContextRequested(window) )
{
return;
}
Modified: trunk/freeglut/freeglut/src/x11/fg_window_x11_glx.c
===================================================================
--- trunk/freeglut/freeglut/src/x11/fg_window_x11_glx.c 2019-09-18 11:58:31 UTC (rev 1854)
+++ trunk/freeglut/freeglut/src/x11/fg_window_x11_glx.c 2019-09-25 10:08:07 UTC (rev 1855)
@@ -220,7 +220,7 @@
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;
@@ -227,7 +227,7 @@
}
/* 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 ) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|