Crash on setTextureCreationFlag

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
dwfait
Posts: 28
Joined: Sun Sep 24, 2006 8:13 pm

Crash on setTextureCreationFlag

Post by dwfait »

Yea...I searched around and couldn't find anything but this thread here: http://irrlicht.sourceforge.net/phpBB2/ ... php?t=6927

Seems I'm having the same problem execpt i've narrowed it down a bit by using the debugging feature of codeblocks.


I get a segmentation fault on this line of code:

driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);

However I can compile and run the example (12 I think) fine which uses this exact line of code.

I'm not doing much before this line of code, and I couldn't see anything special you need to do that I'm not doing in the example either. Can anyone help out?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The most probable cause of this error is an invalid driver pointer, so check the contents of this variable in the debugger and in your code. It's highly unlikely that this call would fail.
dwfait
Posts: 28
Joined: Sun Sep 24, 2006 8:13 pm

Post by dwfait »

I don't think it's that, as all the other calls to the driver pointer work, such as driver->beginScene(); driver->getTexture() etc...
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

But this call does not do anythign which could lead to a crash, unless the driver is faulty. It simply sets a value to some internal variable. No hardware access, no arrays, nothing dangerous.
dwfait
Posts: 28
Joined: Sun Sep 24, 2006 8:13 pm

Post by dwfait »

It also happens on Node->scaleTexture(1.0f, 20.0f); .

I'm sure I've got it set up OK, I'm using the GNU GCC compiler with the corresponding .a irrlicht file; I've even copied the .a to the local directory.

Edit: Do you want to see the full error message?
dwfait
Posts: 28
Joined: Sun Sep 24, 2006 8:13 pm

Post by dwfait »

Thought I'd post it anyway.

Here's the function the error calls on:

Code: Select all

void cTerrain::Load(const stringc path)
{
	
	Node=smgr->addTerrainSceneNode(path.c_str());
	Node->setMaterialFlag(EMF_LIGHTING, false);
	Node->setScale(vector3df(40, 4.4f, 40));
	Node->setMaterialTexture(0, driver->getTexture("terrain-texture.jpg"));
	Node->setMaterialTexture(1, driver->getTexture("detailmap3.jpg"));
	Node->scaleTexture(1.0f, 20.0f);
	Node->setMaterialType(EMT_DETAIL_MAP);
	
}

and the error:

Code: Select all

#0 0x100d9ee7	ZN3irr14createDeviceExERKNS_27SIrrlichtCreationParametersE (??:??)
#1 0x10177190	ZN3irr14createDeviceExERKNS_27SIrrlichtCreationParametersE (??:??)
#2 0x00401d64	cTerrain::Load (cObjects.cpp:154)
#3 0x0040218d	main (main.cpp:16)

which highlights the scaletexture line.
dwfait
Posts: 28
Joined: Sun Sep 24, 2006 8:13 pm

Post by dwfait »

Revelation.

Don't know why it didn't come up before, but now when i try to compile a new project, i get this:

Warning: The library version of the Irrlicht Engine (1.1) does not match
the version the application was compiled with (1.2). This may cause problems.

Yet I'm using the .a that came with the 1.2 download. :\.
Post Reply