Data size problem and optimization question

Share with us how are you using the powerrrr of the force

Moderator: Alain

Data size problem and optimization question

Postby starstutter » Thu Oct 01, 2009 11:59 am

Hi, I am new to these forums and new to using newton. I am integrating it into a self-made 3D engine (directX and C++) and I am currently trying to get completley situated with the engine. I have 2 questions that I did not find adressed in the FAQ section. Thanks in advance to anyone who can help.

1. When I use float values (this includes the dFloat class packaged with newton), whenever I try to perform a "Get" function such as "GetBodyMatrix" and link to the correct size array of floats (4x4), I am hit with a runtime error that says "stack around variable "outMatrix" is corrupt" (with outMatrix being the 4x4 float array I am attemtping to output to). After some reasearch, I figured out that apparently it is attemtping to output more data than that 2D array can hold. If I try with the dMatrix class, the same thing happens. Then I found out if I use an array of doubles for the matrix, it suddenly works (telling me that it is outputting 64 bit variables rather than 32) and the object behaves correctly. The only way I can get the dFloat class to work is by setting "double precision mode" by using #define. Can anyone tell me what might be going on?

2. The next question is quite a bit simpler:
I have an optimization idea that my application can use. My game world is divided into chunks and obviously the ones that cannot be seen do not need to have newtons full attention, which could waste a lot of CPU time. My idea was to have 2 main worlds for each significant area of the world. One is a high persicion version (running every frame with a time incriment of about 1/40, varying with framerate obviously), and one a low percision version only dealt with once every 10 frames or so. The furthest areas would be shut off completley. So my question is, without re-allocating objects over and over and putting my memory into a blender, is there some way to have one world "give up" a rigid body and give it to the other low precision world? My thought was somewhat along the lines of passing a pointer to the other world and removing the body from the active list of the first.

I hope both of these are clear. My vocabulary is not the best in these aspects (I'm self taught).
starstutter
 
Posts: 3
Joined: Sun Apr 12, 2009 6:12 pm

Re: Data size problem and optimization question

Postby JernejL » Thu Oct 01, 2009 2:32 pm

1. there are several versions of the library, some use 32 bit floating point and others use 64 bit floating point, make sure you link to the right one.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia


Return to User Gallery

Who is online

Users browsing this forum: No registered users and 10 guests

cron