Page 1 of 1

Loading a GeoMipMapSceneNode using Spintz's Addon Problem

Posted: Sun Feb 13, 2005 8:34 pm
by aghaster
I want to use the heightmap loading feature of the spintz's addon for irrlicht,
but i got problems using it properly. I successfully compiled the source from his website http://www.spintz.com/irrlicht/geomipmapscenenode/ . I've gotten through the post http://irrlicht.sourceforge.net/phpBB2/ ... php?t=5166 which talks about it and tried to use an example code from it. I got some problems which was related to an update that was made after that post. My program compiled fine using the modified spintz's includes and lib. But i kept getting access violation errors, the program always crashes while trying to load the heightmap :cry:

Here's my example sourcecode i'm trying to get to work fine :

Code: Select all

#include <irrlicht.h>
#include <iostream>
using namespace std;
using namespace irr;
#pragma comment(lib, "Irrlicht.lib")

int main()
{
	IrrlichtDevice *device =
		createDevice(video::EDT_DIRECTX9, core::dimension2d<s32>(640, 480));

	video::IVideoDriver* driver = device->getVideoDriver();
	scene::ISceneManager* smgr = device->getSceneManager();

	scene::IGeoMipMapSceneNode* mipmap = smgr->addGeoMipMapSceneNode(0, 0, 5, scene::EPS_17,
		core::vector3df (0.0f, 0.0f, 0.0f), core::vector3df (0.0f, 0.0f, 0.0f),
		core::vector3df (0.0f, 0.0f, 0.0f));
	mipmap->LoadHeightMap("freeworld04.bmp");
	mipmap->setMaterialTexture ( 0, driver->getTexture ( "grassdetail.bmp" ) );
	mipmap->setMaterialTexture ( 1, driver->getTexture ( "freeworld04_lightmap.bmp" ) );
	mipmap->setMaterialFlag ( video::EMF_LIGHTING, false );
	mipmap->setMaterialFlag ( video::EMF_WIREFRAME, true );
	mipmap->setMaterialType ( video::EMT_LIGHTMAP );

	smgr->addCameraSceneNodeFPS();
	device->getCursorControl()->setVisible(false);

	while(device->run())
	{
		driver->beginScene(true, true, video::SColor(0,200,200,200));
		smgr->drawAll();
		driver->endScene();
	}
	device->drop();
	return 0;
}
I'm using the resources from the demo that spintz give out. It is sad that spintz doesnt give out the sourcecode from his little demo program, it would have been easier for me to start me up with his addon ( or maybe its already out somewhere i dont know )

Could anyone help me? :)
If you have any working code that uses it already, please paste it on this forum it will be very useful for me!

Posted: Mon Feb 14, 2005 4:44 am
by deprecated
Try captain_kill's code on page 2 of that thread... It is what I used at first to get it working... If you cant get it to work say so... and I'll post a sample later.

Also, try resizing the freeworld bmp file , its 512x512, try 256x256 if you are having problems...