simplified check for whether opengl 2.1+ context is requested.

Flags or profile set are now ignored unless opengl 2.1+ context is
requested


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1198 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
dcnieho 2012-03-19 00:31:00 +00:00
parent 468a43416d
commit 1d91d09834
4 changed files with 5 additions and 17 deletions

View File

@ -956,7 +956,6 @@ SFG_Proc fgPlatformGetProcAddress( const char *procName );
#define ATTRIB(a) attributes[where++]=(a) #define ATTRIB(a) attributes[where++]=(a)
#define ATTRIB_VAL(a,v) {ATTRIB(a); ATTRIB(v);} #define ATTRIB_VAL(a,v) {ATTRIB(a); ATTRIB(v);}
int fghIsLegacyContextVersionRequested( void );
int fghMapBit( int mask, int from, int to ); int fghMapBit( int mask, int from, int to );
int fghIsLegacyContextRequested( void ); int fghIsLegacyContextRequested( void );
void fghContextCreationError( void ); void fghContextCreationError( void );

View File

@ -70,16 +70,9 @@ extern void fgPlatformGlutFullScreenToggle( SFG_Window *win );
/* -- PRIVATE FUNCTIONS ---------------------------------------------------- */ /* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
int fghIsLegacyContextVersionRequested( void )
{
return fgState.MajorVersion < 2 || (fgState.MajorVersion == 2 && fgState.MinorVersion <= 1);
}
int fghIsLegacyContextRequested( void ) int fghIsLegacyContextRequested( void )
{ {
return fghIsLegacyContextVersionRequested() && return fgState.MajorVersion < 2 || (fgState.MajorVersion == 2 && fgState.MinorVersion <= 1);
fgState.ContextFlags == 0 &&
fgState.ContextProfile == 0;
} }
int fghNumberOfAuxBuffersRequested( void ) int fghNumberOfAuxBuffersRequested( void )

View File

@ -113,10 +113,8 @@ static wchar_t* fghWstrFromStr(const char* str)
static void fghFillContextAttributes( int *attributes ) { static void fghFillContextAttributes( int *attributes ) {
int where = 0, contextFlags, contextProfile; int where = 0, contextFlags, contextProfile;
if ( !fghIsLegacyContextVersionRequested() ) {
ATTRIB_VAL( WGL_CONTEXT_MAJOR_VERSION_ARB, fgState.MajorVersion ); ATTRIB_VAL( WGL_CONTEXT_MAJOR_VERSION_ARB, fgState.MajorVersion );
ATTRIB_VAL( WGL_CONTEXT_MINOR_VERSION_ARB, fgState.MinorVersion ); ATTRIB_VAL( WGL_CONTEXT_MINOR_VERSION_ARB, fgState.MinorVersion );
}
contextFlags = contextFlags =
fghMapBit( fgState.ContextFlags, GLUT_DEBUG, WGL_CONTEXT_DEBUG_BIT_ARB ) | fghMapBit( fgState.ContextFlags, GLUT_DEBUG, WGL_CONTEXT_DEBUG_BIT_ARB ) |

View File

@ -177,10 +177,8 @@ int fghChooseConfig(GLXFBConfig* fbconfig)
static void fghFillContextAttributes( int *attributes ) { static void fghFillContextAttributes( int *attributes ) {
int where = 0, contextFlags, contextProfile; int where = 0, contextFlags, contextProfile;
if ( !fghIsLegacyContextVersionRequested() ) {
ATTRIB_VAL( GLX_CONTEXT_MAJOR_VERSION_ARB, fgState.MajorVersion ); ATTRIB_VAL( GLX_CONTEXT_MAJOR_VERSION_ARB, fgState.MajorVersion );
ATTRIB_VAL( GLX_CONTEXT_MINOR_VERSION_ARB, fgState.MinorVersion ); ATTRIB_VAL( GLX_CONTEXT_MINOR_VERSION_ARB, fgState.MinorVersion );
}
contextFlags = contextFlags =
fghMapBit( fgState.ContextFlags, GLUT_DEBUG, GLX_CONTEXT_DEBUG_BIT_ARB ) | fghMapBit( fgState.ContextFlags, GLUT_DEBUG, GLX_CONTEXT_DEBUG_BIT_ARB ) |