Allows to override GL version for SDL.
Tested By: Stan Differential Revision: https://code.wildfiregames.com/D3448 This was SVN commit r24768.
This commit is contained in:
parent
0ce8efc286
commit
e7e6fe139e
@ -53,6 +53,12 @@ bpp = 0
|
||||
; Preferred display (for multidisplay setups, only works with SDL 2.0)
|
||||
display = 0
|
||||
|
||||
; Allows to force GL version for SDL
|
||||
forceglversion = false
|
||||
forceglprofile = "compatibility" ; Possible values: compatibility, core, es
|
||||
forceglmajorversion = 3
|
||||
forceglminorversion = 3
|
||||
|
||||
; Emulate right-click with Ctrl+Click on Mac mice
|
||||
macmouse = false
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "ps/CConsole.h"
|
||||
#include "ps/CLogger.h"
|
||||
#include "ps/ConfigDB.h"
|
||||
#include "ps/CStr.h"
|
||||
#include "ps/Filesystem.h"
|
||||
#include "ps/Game.h"
|
||||
#include "ps/Pyrogenesis.h"
|
||||
@ -223,6 +224,37 @@ bool CVideoMode::InitSDL()
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
|
||||
#endif
|
||||
|
||||
bool forceGLVersion = false;
|
||||
CFG_GET_VAL("forceglversion", forceGLVersion);
|
||||
if (forceGLVersion)
|
||||
{
|
||||
CStr forceGLProfile = "compatibility";
|
||||
int forceGLMajorVersion = 3;
|
||||
int forceGLMinorVersion = 0;
|
||||
CFG_GET_VAL("forceglprofile", forceGLProfile);
|
||||
CFG_GET_VAL("forceglmajorversion", forceGLMajorVersion);
|
||||
CFG_GET_VAL("forceglminorversion", forceGLMinorVersion);
|
||||
|
||||
int profile = SDL_GL_CONTEXT_PROFILE_COMPATIBILITY;
|
||||
if (forceGLProfile == "es")
|
||||
profile = SDL_GL_CONTEXT_PROFILE_ES;
|
||||
else if (forceGLProfile == "core")
|
||||
profile = SDL_GL_CONTEXT_PROFILE_CORE;
|
||||
else if (forceGLProfile != "compatibility")
|
||||
LOGWARNING("Unknown force GL profile '%s', compatibility profile is used", forceGLProfile.c_str());
|
||||
|
||||
if (forceGLMajorVersion < 1 || forceGLMinorVersion < 0)
|
||||
{
|
||||
LOGERROR("Unsupported force GL version: %d.%d", forceGLMajorVersion, forceGLMinorVersion);
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, profile);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, forceGLMajorVersion);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, forceGLMinorVersion);
|
||||
}
|
||||
}
|
||||
|
||||
if (!SetVideoMode(w, h, bpp, m_ConfigFullscreen))
|
||||
{
|
||||
// Fall back to a smaller depth buffer
|
||||
|
Loading…
Reference in New Issue
Block a user