Last active
September 7, 2019 12:20
-
-
Save martyglaubitz/d05495f27f330945fc6d6c253a52f424 to your computer and use it in GitHub Desktop.
Utility to automatically select the best suitable video driver for Irrlicht
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include "select_driver.h" | |
IrrlichtDevice* createDeviceWithBestGraphicsDriver(dimension2d<u32> resolution) | |
{ | |
for (auto driverType : driverTypesByPreference) | |
{ | |
IrrlichtDevice *result = createDevice( driverType, resolution, 16, | |
false, false, false, 0); | |
if (result) | |
{ | |
std::cout << "Using driver: " << driverType << std::endl; | |
return result; | |
} | |
} | |
return NULL; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <irrlicht.h> | |
using namespace irr; | |
using namespace core; | |
using namespace video; | |
// you may change the order to suit your preference | |
const E_DRIVER_TYPE driverTypesByPreference[3] = { | |
video::EDT_DIRECT3D9, | |
video::EDT_DIRECT3D8, | |
video::EDT_OPENGL | |
}; | |
IrrlichtDevice* createDeviceWithBestGraphicsDriver(dimension2d<u32> resolution); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment