A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by Madman07 » Thu Jul 19, 2012 1:43 pm
Hi, I'm new here

Like title says, I'm using new Newton 300. Without serious problems I made Newton working with my Ogre game without any wrappers. The problem is, there is no ReleaseCollision function. It has ben removed or renamed? Because right now, I've got count error on my application exit.
Thanks in advance,
Madman07
-
Madman07
-
- Posts: 15
- Joined: Thu Jul 19, 2012 1:40 pm
by Julio Jerez » Thu Jul 19, 2012 1:54 pm
in core 300 collision are instances, each tiem you asign one to a body teh body get his own copy.
the semantic for usin collsion in core 300 is
- Code: Select all
NewtonCollision* cont shape = CreateNewtonBox (world, smilly, 0);
NewtonBody* const bidy1 = CreateRigidBody (world, smilly, shape, 10.0f);
NewtonBody* const bidy2 = CreateRigidBody (world, smilly, shape, 10.0f);
// create as many bodies as you want each will have their own collision shape
// ...
// destroy the collision shape used to make the body
NewtonDestroyCollision(shape);
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by FSA » Thu Jul 19, 2012 5:36 pm
Why does CreateRigidBody return an NewtonCollision*? And what means "cont"? I want to update too, but i have some problems to understand the new core

-

FSA
-
- Posts: 322
- Joined: Wed Dec 21, 2011 9:47 am
by Madman07 » Thu Jul 19, 2012 5:58 pm
Ah thank. I's a bit confusing, but now I get it.
@Letter123, it has to be a typo. CreateRigidBody returns NewtonBody*

-
Madman07
-
- Posts: 15
- Joined: Thu Jul 19, 2012 1:40 pm
by Julio Jerez » Thu Jul 19, 2012 7:16 pm
Madman07 wrote:@Letter123, it has to be a typo. CreateRigidBody returns NewtonBody*

upps, my mistake, I fixed it in the post.
thanks
type* const
is a way to tell a a compiler, that it is free to optimized that pointer into a register.
It allows a compile to generate very optimal code that does no suffer from pointer alising.
I general compiler have to recompute relative address each time they derreference a pointer,
the *const tell the compile that that pointer will ne be modified directly or indirectly.
It does not do much on intell compuler in 32 bit mode, but it makes big difference in 64 bit code witch uses 16 registers,
and it makes tremendous difference on CPUs with lots of registers. (arms and powoer pcs and consoless)
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Madman07 » Wed Aug 29, 2012 10:21 am
Weird, but that did not helped. I've still getting error (but only in Debug build, so not so annoying)
- Code: Select all
dgMemory.cpp
at line 38
GetCount() == 0;
I'm using NewtonDestroyCollision(shape) everywhere. The most interesting part is, that I'm getting that error even, when my worlds are empty.
-
Madman07
-
- Posts: 15
- Joined: Thu Jul 19, 2012 1:40 pm
by Julio Jerez » Wed Aug 29, 2012 12:14 pm
what errors?
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Madman07 » Wed Aug 29, 2012 12:56 pm
Like I've mentioned in previous post. Error appear, when I'm closing my application (even, if newton world is empty and didn't constructed AN collision).
- Code: Select all
Debug Assertion Failed
File: ..\source\core\dgMemory.cpp
Line: 38
Expression: GetCount() == 0
-
Madman07
-
- Posts: 15
- Joined: Thu Jul 19, 2012 1:40 pm
by Julio Jerez » Wed Aug 29, 2012 1:42 pm
Oh I see, Netwon core 300 uses pThread, Unfortunally pthread is impelmnet with inline macros.
I have no figuire out how to hide the PTW32_STATIC_LIB when using it as a static libraryy.
in your project you need to do in visual studio project explore select the project library that include prthread source code and do this:
options->preprocessor->Preprocessor definitions
and add these two defines
PTW32_BUILD
PTW32_STATIC_LIB
try that see if the leak goes away.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Madman07 » Wed Aug 29, 2012 3:57 pm
What do you mean by:
select the project library that include prthread source code
I don't have any pThread source in my projects.
I've tried to put those defines into option->C++->preprocessor->Preprocessor definitions without any luck

-
Madman07
-
- Posts: 15
- Joined: Thu Jul 19, 2012 1:40 pm
by Julio Jerez » Wed Aug 29, 2012 8:29 pm
newton 300 uses pthreads.
you have to have some wrong setting, there are no memory leaks in newton
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 2 guests