Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/ps/VideoMode.cpp
Show All 24 Lines | |||||
#include "lib/config2.h" | #include "lib/config2.h" | ||||
#include "lib/ogl.h" | #include "lib/ogl.h" | ||||
#include "lib/external_libraries/libsdl.h" | #include "lib/external_libraries/libsdl.h" | ||||
#include "lib/sysdep/gfx.h" | #include "lib/sysdep/gfx.h" | ||||
#include "lib/tex/tex.h" | #include "lib/tex/tex.h" | ||||
#include "ps/CConsole.h" | #include "ps/CConsole.h" | ||||
#include "ps/CLogger.h" | #include "ps/CLogger.h" | ||||
#include "ps/ConfigDB.h" | #include "ps/ConfigDB.h" | ||||
#include "ps/CStr.h" | |||||
#include "ps/Filesystem.h" | #include "ps/Filesystem.h" | ||||
#include "ps/Game.h" | #include "ps/Game.h" | ||||
#include "ps/Pyrogenesis.h" | #include "ps/Pyrogenesis.h" | ||||
#include "ps/GameSetup/Config.h" | #include "ps/GameSetup/Config.h" | ||||
#include "renderer/Renderer.h" | #include "renderer/Renderer.h" | ||||
#if OS_MACOSX | #if OS_MACOSX | ||||
# include "lib/sysdep/os/osx/osx_sys_version.h" | # include "lib/sysdep/os/osx/osx_sys_version.h" | ||||
▲ Show 20 Lines • Show All 177 Lines • ▼ Show 20 Lines | |||||
#if CONFIG2_GLES | #if CONFIG2_GLES | ||||
// Require GLES 2.0 | // Require GLES 2.0 | ||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES); | SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES); | ||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); | SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); | ||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); | SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); | ||||
#endif | #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)) | if (!SetVideoMode(w, h, bpp, m_ConfigFullscreen)) | ||||
{ | { | ||||
// Fall back to a smaller depth buffer | // Fall back to a smaller depth buffer | ||||
// (The rendering may be ugly but this helps when running in VMware) | // (The rendering may be ugly but this helps when running in VMware) | ||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); | SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); | ||||
if (!SetVideoMode(w, h, bpp, m_ConfigFullscreen)) | if (!SetVideoMode(w, h, bpp, m_ConfigFullscreen)) | ||||
return false; | return false; | ||||
▲ Show 20 Lines • Show All 277 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator