terrain problems

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Kanaran
Posts: 2
Joined: Mon Mar 15, 2004 1:26 pm

terrain problems

Post by Kanaran »

hi there.

i m new at irrlicht and almost new at c++ (and not really new but never were good in english :P )

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;
}
the result is a grey window with no terrain in it.

can anybody explain me why?
soconne
Posts: 87
Joined: Fri Mar 05, 2004 2:00 pm

Post by soconne »

maybe you should try setting the position and target view of the camera. perhaps set the camera's position to be way far above or away from the terrain and make the target (0,0,0), so its looking directly at the center of the terrain, then maybe you'll see it.
puh
Posts: 356
Joined: Tue Aug 26, 2003 3:53 pm

Post by puh »

PNG are not supported if you didn't add this loader by yourself.
Post Reply