From: Diederick C. N. <dc...@gm...> - 2012-03-18 08:37:49
|
Dear All, I was just reading through the code for setting up the OpenGL context, and some weird things are going on I think. The current code in question is: int fghIsLegacyContextVersionRequested( void ) { return fgState.MajorVersion < 2 || (fgState.MajorVersion == 2 && fgState.MinorVersion <= 1); } int fghIsLegacyContextRequested( void ) { return fghIsLegacyContextVersionRequested() && fgState.ContextFlags == 0 && fgState.ContextProfile == 0; } Frankly, I'm not seeing the point of the second. What it means is that if an application sets a context flag or context profile (think e.g. WGL_CONTEXT_DEBUG_BIT_ARB and WGL_CONTEXT_CORE_PROFILE_BIT_ARB), but does not request a OGL 2.1+ context (a non-sensical combination: the flag and profile are 3.0+), fghIsLegacyContextVersionRequested will return true, but fghIsLegacyContextRequested will return false. On windows, this triggers a code path that will try to create a legacy context but with the flags and/or profile set. This will fail as its not a sensible combination. On the other hand, asking for a OGL 2.1+ context while not specifying flags or profile works fine (both have defaults). So why not merge these two functions into one, which only checks the requested opengl version? That would make sense. Shall I do it (rename fghIsLegacyContextVersionRequested to fghIsLegacyContextRequested and remove the current fghIsLegacyContextRequested)? Best, Dee |