Debug Assertion Failed! - error when loading a textured 3ds

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
jack_1313
Posts: 13
Joined: Sat Jan 10, 2004 5:25 am
Location: Australia
Contact:

Debug Assertion Failed! - error when loading a textured 3ds

Post by jack_1313 »

In attempting to load an un-textured 3ds file created with Anim8or, all is well. But after I add a material and texture to the object, I receive the following ‘error’ when loading:

Debug Assertion Failed!

Program: (path to my project)
File: fopen.c
Line: 54

Expression: *file != _T('\0')

For information on how your program can cause an assertion failure, see the Visual C++ documentation on assets.


I am using Visual C++ 6.0. The odd thing here is that if I click “Ignore” then the game runs fine – the 3ds file is loaded correctly – textures and all. However, this error is largely annoying because it surfaces several times for each 3ds file loaded. Obviously the problem regards the loading of the model texture, but this is controlled by the engine and is out of my hands. I do not wish to do it manually.

The 3ds loading code:

Code: Select all

IAnimatedMesh* mesh = smgr->getMesh("land.3ds");
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh ,0,-1,core::vector3df(0,0,0),core::vector3df(0,0,0),core::vector3df(0.3,0.3,0.3));
Clearly, all is as it should be. The 3ds file contains only one material. I suspect this is a bug, of which should be fixed if possible.

Off topic, any plans to update Irrlicht to DirectX 9.0b?
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Hm, that assert is strange. Could you post the line in which it is caused in the irrlicht dll?

I'll update the engine to dx9.0, yes, but not in the near future.
jack_1313
Posts: 13
Joined: Sat Jan 10, 2004 5:25 am
Location: Australia
Contact:

More info

Post by jack_1313 »

I have discovered more information. There is no error when using the Irrlicht ‘release’ dll that is included with the SDK. However, I had made some minor changes to the engine after downloading – basically just killing the FPS camera control so that I could do it all manually, giving much more freedom over the camera.
When I use the new dll I get the assertion failure. I am using MS Visual Studio 6.0, running WindowXP and receive no warnings or errors when compiling the engine. Even if I make absolutley no changes to the source of the engine and copile I still get a faulty dll.
The error dialog does not specify the line of the Irrlicht engine causing the problem, but I imagine that it is a #include <whatever>, as a search for the word fopen.c in the engine revealed nothing, meaning that a file included in turn includes this file – it seems that the problem is not within the engine’s coding. Odd, however, as I cannot why the D3D device would be using such a header file to load a texture.
It is rather important that I make changes to the engine, so I hope I can resolve this problem. Any thoughts as too why the dll is compiling with this error?

On a side note, are you aware that to compile the engine the user must add several source files to the MSVC++ project included? Also, by making several minor changes to the engine source, the ‘climbing walls’ problem that I noticed initially is easily fixed – I can provide details if you like (10 or so lines of code to replace a section of the FPS Camera class source file).
Boogle
Posts: 162
Joined: Fri Nov 21, 2003 3:16 pm
Location: Toronto, Canada

Post by Boogle »

If you didn't want the FPS camera control, couldn't you just create a standard camera and not modify the FPS camera?
jack_1313
Posts: 13
Joined: Sat Jan 10, 2004 5:25 am
Location: Australia
Contact:

jack_1313

Post by jack_1313 »

I need the cursor control, but wish to do the movement myself. The simplest way I found (without looking too deeply - this is not my current project, I am just looking into it at this stage) was to rip out the movement code and then do it manualy, while leaving the cursor contol active. Can a normal camera be easily tied with cursor control? I intend to involve myself more when my time frees up.
However, that said, I expect it will be very rather important that I can modify the engine when the time comes to do so.
WarZone - A 2D Action Wargame
http://warzone2d.zapto.org
Boogle
Posts: 162
Joined: Fri Nov 21, 2003 3:16 pm
Location: Toronto, Canada

Post by Boogle »

Well, using more shameless self-plugging, yes, it is possible to write your own camera object tied to cursor control. Check out my 3rd person camera animator:

http://irrlicht.sourceforge.net/phpBB2/ ... .php?t=961

You just attach it to a standard camera, give it an object to follow, and it animates the camera based on mouse movements. In my opinion, animators are the better way to go anyway, and think Niko should have used an FPSAnimator and MayaAnimator rather than different implementations of the camera class. But either method works, it just depends on how you look at the structure I suppose.
jack_1313
Posts: 13
Joined: Sat Jan 10, 2004 5:25 am
Location: Australia
Contact:

Post by jack_1313 »

Hey, I'm about to take a look at your camera. However, I am 100% satisfied with the camera and movment I have set up at the moment - not only does it not climb walls, but it no-longer moves slowly when you aim at the sky or at the ground (instead of moving towards the point the player is aiming at, the camera moves x and z toward the x and z of the player's aim, but at a fixed y of 0 - similar to strafing, but forward).
And I must stress the fact that I will (most likely) need to be able to make additions to the engine and compile the dll (error free). Any ideas Niko? What IDE and compiler are you using yourself?
WarZone - A 2D Action Wargame
http://warzone2d.zapto.org
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post by keless »

jack_1313 wrote:I will (most likely) need to be able to make additions to the engine and compile the dll (error free).
this makes sence, but you should be careful when modifying the engine-- unless you are making bug fixes, you shouldnt mess with whats already there. instead, you should only be making extentions-- write a new class/new functions. This way not only can other people use your code without fscking up their own copy of the engine, it'll also be easier to integrate again when a new version comes around.
a screen cap is worth 0x100000 DWORDS
rt
Posts: 150
Joined: Sun Nov 30, 2003 6:54 am
Location: canada
Contact:

Re: Debug Assertion Failed! - error when loading a textured

Post by rt »

jack_1313 wrote:Program: (path to my project)
File: fopen.c
Line: 54

Expression: *file != _T('\0')
i used to get this as well. to fix it either compile the engine in release mode or edit CReadFile.cpp and add this at the start of CReadFile::openFile()

Code: Select all

	if (Filename.c_str()[0] == NULL) {
		File = NULL;
		return;
	}
jack_1313
Posts: 13
Joined: Sat Jan 10, 2004 5:25 am
Location: Australia
Contact:

Post by jack_1313 »

Thanks rt, I'd already tried building in release mode and it had not made a difference. I added the code, and the problem is solved. It confuses me a little though - if the filename string is empty, then why does it load the texture regardless?
WarZone - A 2D Action Wargame
http://warzone2d.zapto.org
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Thanks rt, I added this now into the code.

Code: Select all

if (Filename.size() == 0) // bugfix posted by rt
{
	File = 0;
	return; 
}
Post Reply