Well
hybrid is completely right, for more informations about createDeviceEx :
http://irrlicht.sourceforge.net/docu/na ... .html#a179
About the issues as i said the output is :
Code: Select all
Was not able to create Direct3D9 device.
Was not able to create DIRECT3D9 device.
Could not create DIRECT3D9 Driver.
which refers to CD3D9Driver.cpp line 359 :
Code: Select all
hr = pID3D->CreateDevice(D3DADAPTER_DEFAULT, devtype, hwnd,
fpuPrecision | D3DCREATE_HARDWARE_VERTEXPROCESSING, &present, &pID3DDevice);
if(FAILED(hr))
hr = pID3D->CreateDevice(D3DADAPTER_DEFAULT, devtype, hwnd,
fpuPrecision | D3DCREATE_MIXED_VERTEXPROCESSING , &present, &pID3DDevice);
if(FAILED(hr))
hr = pID3D->CreateDevice(D3DADAPTER_DEFAULT, devtype, hwnd,
fpuPrecision | D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present, &pID3DDevice);
if (FAILED(hr))
os::Printer::log("Was not able to create Direct3D9 device.", ELL_ERROR);
}
if (!pID3DDevice)
{
os::Printer::log("Was not able to create DIRECT3D9 device.", ELL_ERROR);
return false;
}
I've tried a lot of combinations and here is finally the behavior which produce the crash :
- - only happen with directx (both Direct3D 8.1 and Direct3D 9)
- only in fullscreen
- and finally, only in 1280x800 (which is my highest resolution)
About the code :
Code: Select all
while (still_running)
{
engine_graphic->update();
}
Code: Select all
CENGINEGraphic::CENGINEGraphic()
{
// Initializes
SIrrlichtCreationParameters param;
param.AntiAlias = false;
param.Bits = 32;
param.DriverType = EDT_DIRECT3D9;
param.Fullscreen = true;
param.Stencilbuffer = false;
param.Vsync = false;
param.WindowSize = dimension2d<s32>(1280, 800);
initEngine(param);
}
void CENGINEGraphic::initEngine(SIrrlichtCreationParameters deviceParam)
{
try
{
device = createDeviceEx(deviceParam);
// Gets video driver
videoDriver = device->getVideoDriver();
// Gets scene manager
sceneManager = device->getSceneManager();
// Gets gui environment
guiEnv = device->getGUIEnvironment();
}
catch (exception &e)
{
cerr << e.what() << endl;
}
reset_engine = false;
}
void CENGINEGraphic::resetEngine()
{
// Clear
videoDriver->removeAllTextures();
guiEnv->clear();
sceneManager->clear();
videoDriver->drop();
videoDriver = NULL;
guiEnv = NULL;
sceneManager = NULL;
// Closes the device
if (device)
{
device->setEventReceiver(NULL);
device->closeDevice();
device->run();
device->drop();
device = NULL;
}
// Re-inits the engine
initEngine(getNewDeviceParam());
}
void CENGINEGraphic::update()
{
if (reset_engine)
resetEngine();
else
{
if (!videoDriver || !device->run())
exit();
//** Render
videoDriver->beginScene(true, true, background_color);
sceneManager->drawAll();
guiEnv->drawAll();
videoDriver->endScene();
//**
}
}
I think the code is easy understanding. The window contain one checkbox per device property and one button to apply the changes (which simply set reset_engine to true and keep the new parameters)
Causing the crash is just to play randomly with AntiAlias, Stencilbuffer and Vsync.
My system informations :
- - Irrlicht Engine version 1.4
- Microsoft Windows XP Professional Service Pack 3 (Build 2600)
- NVIDIA GeForce Go 7400 nv4_disp.dll 6.14.10.8418
- 2046MB RAM
- DirectX 9.0c (4.09.0000.0904)
Thanks for your help