Box2D Forums

It is currently Thu May 23, 2013 2:30 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sat Jun 21, 2008 7:19 am 
Offline

Joined: Sat Jun 21, 2008 7:01 am
Posts: 17
on my desktop machine (q6600 - Ubuntu 64bit ) the following code works fine
Code:
   float r;
   r=1.25;

   polyDef.vertexCount = 6;
   polyDef.friction = 0.1f;
   polyDef.vertices[5].Set(0.866025404*r, 0.5*r);
   polyDef.vertices[4].Set(0.866025404*r, -0.5*r);
   polyDef.vertices[3].Set(0, -r);
   polyDef.vertices[2].Set(-0.866025404*r, -0.5*r);
   polyDef.vertices[1].Set(-0.866025404*r, 0.5*r);
   polyDef.vertices[0].Set(0, r);

   bodyDef.position.Set(24.f,2.0);
   body=m_world->CreateBody(&bodyDef);
   body->CreateShape(&polyDef);
   body->SetMassFromShapes();

   ents[13]=new entity(body);
   body->SetUserData(ents[13]);
   ents[13]->setTexture(texture[0]);


however on my eeePc (intel celeron M) it causes the following error

Quote:
oglsdlbox2d: Dynamics/Contacts/b2ContactSolver.cpp:103: b2ContactSolver::b2ContactSolver(const b2TimeStep&, b2Contact**, int32, b2StackAllocator*): Assertion `kEqualized > 1.19209290e-7F' failed.


In both cases I'm using the float variant of the library
(I've noticed some errors with the fixed version using the testbed on my desktop)

I'm using SVN revision 166

btw nice library, I like the idea of prototype (def) objects to save dozens of parameters in a single call, its nice and fast, and seems straight forward. Thanks!


Top
 Profile  
 
PostPosted: Sat Jun 21, 2008 2:53 pm 
Offline

Joined: Sun Sep 23, 2007 2:35 pm
Posts: 803
I've run into similar issues even on the same processor - with B2_TOI_JOINTS enabled (which at the moment they are not, since the implementation is not finished), it turned out that even in the unfinished state, the examples all ran stably on OS X, but some of them blew up in Windows. I gave up on tracking the difference down completely, since the blowups were actually to be expected given that the joints were not meant to be used with TOI, but from what I could tell, the fundamental issue was the difference between the default internal precision that OS X uses (80 bit) as opposed to Windows (53 bit, or somewhere around there).

I don't know the details of the eeePC, but there might be something similar going on.

That said, from what I remember, having run into that assert several times myself recently, I've almost always been able to trace the cause to a NaN popping up somewhere, usually due to an accidental divide by zero in my own code (which, again, could be coming up sporadically because to different internal precision/compiler optimization settings). What is that shape colliding with?


Top
 Profile  
 
PostPosted: Sat Jun 21, 2008 7:05 pm 
Offline

Joined: Sat Jun 21, 2008 7:01 am
Posts: 17
I rather think its a symptom of another problem as its started happening on my desktop machine.
(the eeePc is running Debian btw but it *is* a 32bit machine - so was maybe giving early warning)

The problem will sometimes change depending on what shapes I initially add

I think its some kind of memory corruption problem, but for the life of me I can't see it
(the test bed is working fine in float mode so I know this is all down to me - alas!!)


Top
 Profile  
 
PostPosted: Sat Jun 21, 2008 8:26 pm 
Offline

Joined: Sat Jun 21, 2008 7:01 am
Posts: 17
I altered my "entity" class to have a separate shape and body "define" object as the way I was sharing them seemed to be causing problems??


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group