i m new at irrlicht and almost new at c++ (and not really new but never were good in english
i studied all the tutorials and tried to read the docs. and after hours reading the forum my last hope is the community....
all i wanna do is to generate a "huge" outdoor terrain.
let me show you my last try:
Code: Select all
#include <irrlicht.h>
using namespace irr;
#pragma comment(lib, "Irrlicht.lib")
IrrlichtDevice* device = 0;
int main()
{
IrrlichtDevice *device =
createDevice(video::EDT_DIRECTX9, core::dimension2d<s32>(640, 480),
16, false, false);
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
scene::ISceneNode* node = 0;
scene::IAnimatedMesh* mesh = smgr->addTerrainMesh( "myter",
driver->createImageFromFile("TEXTURE.PNG"),
driver->createImageFromFile("DETAILMAP.PNG"),
core::dimension2d< f32 >(10.0f, 10.0f),
200.0f,
core::dimension2d< s32 >(64, 64)
);
node = smgr->addOctTreeSceneNode(mesh, 0, -1, 128 );
smgr->addCameraSceneNodeFPS();
device->getCursorControl()->setVisible(false);
/*
We have done everything, so lets draw it. We also write the current
frames per second and the drawn primitives to the caption of the
window.
*/
int lastFPS = -1;
while(device->run())
{
driver->beginScene(true, true, video::SColor(0,100,100,100));
smgr->drawAll();
driver->endScene();
int fps = driver->getFPS();
if (lastFPS != fps)
{
wchar_t tmp[1024];
swprintf(tmp, 1024, L"My First Terrain - Irrlicht Engine (fps:%d) Triangles:%d",
fps, driver->getPrimitiveCountDrawn());
device->setWindowCaption(tmp);
lastFPS = fps;
}
}
/*
In the end, delete the Irrlicht device.
*/
device->drop();
return 0;
}
can anybody explain me why?