Skip to content

Instantly share code, notes, and snippets.

@martyglaubitz
Last active September 7, 2019 12:20
Show Gist options
  • Save martyglaubitz/d05495f27f330945fc6d6c253a52f424 to your computer and use it in GitHub Desktop.
Save martyglaubitz/d05495f27f330945fc6d6c253a52f424 to your computer and use it in GitHub Desktop.
Utility to automatically select the best suitable video driver for Irrlicht
#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;
}
#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