It does not occur when a TerrainSceneNode is used, and it is not a problem in Irrlicht-1.4.2.
I’ve tried this on 3 different PCs (using VS2005) and get the same results on each.
The crash occurs on line 2332 of cd3d9driver.cpp, in the reset function.
I came across this while upgrading the code for my 3d viewer to use Irrlicht-1.5. The code below illustrates the problem.
If there’s a change I need to make to the code to get this to work with Irrlicht-1.5, I’d like to hear about it; otherwise it looks like a bug to me.
Code: Select all
#include "C:\Program Files\irrlicht-1.5\include\irrlicht.h"
//#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
#ifdef _IRR_WINDOWS_
#pragma comment(lib, "C:\\Program Files\\irrlicht-1.5\\lib\\Win32-visualstudio\\Irrlicht.lib")
//#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif
int main()
{
IrrlichtDevice *device =
#ifdef _IRR_OSX_PLATFORM_
createDevice( video::EDT_OPENGL, dimension2d<s32>(640, 480), 16,
false, false, false, 0);
#else
createDevice( video::EDT_DIRECT3D9, dimension2d<s32>(640, 480), 16,
false, false, false, 0);
#endif
if (!device)
return 1;
device->setWindowCaption(L"Irrlicht-1.5 TerrainMesh Test");
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
device->setResizeAble(true);
guienv->addStaticText(L"Press Maximize to see crash",
rect<s32>(10,10,260,22), true);
video::IImage* colorMapImage = driver->createImageFromFile("C:/Program Files/irrlicht-1.5/media/terrain-texture.jpg");
video::IImage* heightMapImage = driver->createImageFromFile("C:/Program Files/irrlicht-1.5/media/terrain-heightmap.bmp");
float pixelSize = 2.f;
// scene::IAnimatedMesh* terrain = smgr->addTerrainMesh ("TestTerrainMesh", heightMapImage, heightMapImage,
scene::IAnimatedMesh* terrain = smgr->addTerrainMesh ("TestTerrainMesh", colorMapImage, heightMapImage,
core::dimension2d< f32 >(pixelSize, pixelSize), // size of a pixel
50.0f); // maximum height
colorMapImage->drop();
heightMapImage->drop();
ISceneNode* node = smgr->addAnimatedMeshSceneNode(terrain);
if (node)
{
node->setPosition(core::vector3df(0.f,0.f,-256.f));
node->setMaterialFlag(EMF_LIGHTING, false);
}
smgr->addCameraSceneNode(0, vector3df(1000,500,0), vector3df(0,0,0));
while(device->run())
{
driver->beginScene(true, true, SColor(255,100,101,140));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
device->drop();
return 0;
}