Allow starting STK with non-gl drivers

This commit is contained in:
Benau 2021-04-19 12:58:46 +08:00
parent 23ec5ba379
commit f95d73c041
2 changed files with 12 additions and 11 deletions

View File

@ -37,6 +37,7 @@ void CentralVideoSettings::init()
m_gl_major_version = 2;
m_gl_minor_version = 1;
m_gl_mem = 0;
m_glsl = false;
// Parse extensions
hasBufferStorage = false;
@ -66,6 +67,16 @@ void CentralVideoSettings::init()
// Call to glGetIntegerv should not be made if --no-graphics is used
if (!GUIEngine::isNoGraphics())
{
if (GE::getDriver()->getDriverType() != video::EDT_OPENGL &&
GE::getDriver()->getDriverType() != video::EDT_OGLES2)
{
GraphicsRestrictions::init("", "", GE::getDriver()->getVendorInfo().c_str());
GE::getGEConfig()->m_disable_npot_texture =
GraphicsRestrictions::isDisabled(
GraphicsRestrictions::GR_NPOT_TEXTURES);
return;
}
glGetIntegerv(GL_MAJOR_VERSION, &m_gl_major_version);
glGetIntegerv(GL_MINOR_VERSION, &m_gl_minor_version);
const char *vendor = (const char *)glGetString(GL_VENDOR);

View File

@ -475,11 +475,7 @@ void IrrDriver::initDevice()
UserConfigParams::m_gamepad_visualisation);
// Try 32 and, upon failure, 24 then 16 bit per pixels
#ifdef __SWITCH__
int bits=24;
#else
for (int bits=32; bits>15; bits -=8)
#endif
{
if(UserConfigParams::logMisc())
Log::verbose("irr_driver", "Trying to create device with "
@ -536,12 +532,8 @@ void IrrDriver::initDevice()
*/
m_device = createDeviceEx(params);
#ifdef __SWITCH__
assert(m_device != NULL);
#else
if(m_device)
break;
#endif
} // for bits=32, 24, 16
@ -580,6 +572,7 @@ void IrrDriver::initDevice()
}
#ifndef SERVER_ONLY
GE::init(m_device->getVideoDriver());
// Assume sp is supported
CentralVideoSettings::m_supports_sp = true;
CVS->init();
@ -625,9 +618,6 @@ void IrrDriver::initDevice()
m_scene_manager = m_device->getSceneManager();
m_gui_env = m_device->getGUIEnvironment();
m_video_driver = m_device->getVideoDriver();
#ifndef SERVER_ONLY
GE::init(m_video_driver);
#endif
B3DMeshLoader* b3dl = new B3DMeshLoader(m_scene_manager);
m_scene_manager->addExternalMeshLoader(b3dl);