getTriangleCount() ITriangleSelector

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
cartoonit
Posts: 286
Joined: Mon Nov 15, 2004 6:36 pm

getTriangleCount() ITriangleSelector

Post by cartoonit »

I have the following code in sections:

Code: Select all

 
scene::ITriangleSelector *TriSel = mpSmgr->createOctTreeTriangleSelector(LevelMesh->getMesh(0), LevelNode, 128);
LevelNode->setTriangleSelector(TriSel); //TriSel mem address = 0x01E2A078
irr::s32 NoTri = TriSel->getTriangleCount; //TriSel= 7753
Then I pass to another function the TriSel using

Code: Select all

Function(scene::ITriangleSelector *TriSel); //the prototype for this function

irr::s32 NoTri = TriSel->getTriangleCount(); //after this method is called TriSel mem = 0x7ffdc000 and TriSel = -858993460
I know how am I going to get round this problem now, but surely the memory address shouldn't be changed for the TriSel when in a different function, and it is getting set to a random memory address.

EDIT: Actually I really need the triangle selector to be the original, is this a known bug?? I really don't understand why its changing it in the function...

EDIT: Again, ok I've got around it but its still a bug IMO... :roll:
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

Err, if the pointer seems to be changing its mem address when you pass to a function then I think something is more likely to be wrong wtih your code. Maybe it really is a bug, but I simply see no way that one could even create a class of which a pointer to an instance of that class could change its meme adress. Something's gone screwey, but I doubt it's irrlicht . Anyway, it's like somethign I've never seen before. Note that I have passed pointers to trinagle selectors before and it's all been fine
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

behavior like that denotes a memory leak ( likely somewhere else in the code )
cartoonit
Posts: 286
Joined: Mon Nov 15, 2004 6:36 pm

Post by cartoonit »

I will have another look, but as far as I can see the memory address is correct before it gets passed and after its been passed to the function. Its only after the call to getTriangleCount().

I will see whether there are any other problems with my code in the main body, to see whether its a memory leak else where.
Post Reply