Start Newton on the iPhone

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Start Newton on the iPhone

Postby Julio Jerez » Fri Aug 07, 2009 12:20 am

This is a huge is disappointment, the intrisincs do not work in CPP, only in C
This is a show stopper for me because the code is the same for all platform, I can not use C code because I will have to rewrite the entire code base,
basically I have a set of Macros the defined instisics
fo exmple, for SSE it is like this

Code: Select all
      
#define simd_type            __m128
#define simd_env            dgInt32
#define simd_add_v(a,b)            _mm_add_ps (a, b)   
.....


for x87 it is liek this
Code: Select all
#define simd_type            dVector
#define simd_env            int
#define simd_add_v(a,b)            (a + b)   


for altivet it is
Code: Select all
#define simd_type            vFloat
#define simd_char            vUInt8
#define simd_add_v(a,b)            vec_add (a, b)   


so for me to change that to C I will have to chaneg a lot of stuff, maybe I am doing something wrong but I I wrote a test function in CPP I get compiler error, the same function in C compile fine.

It is still better than the Iphone SDK 2.2.1 because the new SDK 3.0 generate code for universal binary ARM6 and ARM7
so maybe the auto vectorization use the neon stuff, untill them I can not use the intrinsics for arm7 cpus
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Start Newton on the iPhone

Postby Julio Jerez » Sat Aug 08, 2009 8:13 pm

Wow the Mac forum is full of hoslily, the people do no answere any quetsion instead teh fell joy on attcaking me personally.
http://discussions.apple.com/message.js ... 88#9959688

It appear there are some people there that have some Beff with Me.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Start Newton on the iPhone

Postby Stucuk » Sat Aug 08, 2009 9:16 pm

It appear there are some people there that have some Beff with Me.

Its got nothing to do with you. Its just that on most forums (Especially large ones) you get alot of Ass's.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Start Newton on the iPhone

Postby winstrol » Sun Aug 09, 2009 1:02 pm

maybe this is better place:
http://www.iphonedevcentral.org/forum/
User avatar
winstrol
 
Posts: 30
Joined: Fri Jul 24, 2009 9:57 pm

Re: Start Newton on the iPhone

Postby Stucuk » Sun Aug 09, 2009 6:32 pm

That url gives an error message. However http://www.iphonedevsdk.com/forum/ which clicking on a forum link from http://www.iphonedevcentral.org/ seems to work. No clue if its the forum you meant.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Start Newton on the iPhone

Postby winstrol » Sun Aug 09, 2009 7:20 pm

yeah, my fault, thx

anyway,
1> do somebody know how to change .3ds model to newton .dat mesh data ??
2> how can I add force to body?

I'm trying something like this, but it doesn't move:
Code: Select all
   // add some visual entities.
   frowny = [sceneManager CreateEntity];
   [frowny LoadMesh:"porche.dat"];
   struct dVector p = frowny.m_curPosition;
   p.m_y = 0.0f + 1.0f;
   frowny.m_curPosition = p;
   shape = CreateNewtonBox (world, frowny, 0);
   frownyBody = CreateRigidBody (world, frowny, shape, 10.0f);

   float force[] = {100.0f, 0.0f, 0.0f};
   [world BodyAddForce :frownyBody :&force[0]];
   
   [world ReleaseCollision: shape];
   


could somebody tell me why, or give some the simplest example in any language ?
User avatar
winstrol
 
Posts: 30
Joined: Fri Jul 24, 2009 9:57 pm

Re: Start Newton on the iPhone

Postby winstrol » Fri Aug 14, 2009 7:41 pm

can anyone help me with that ?
User avatar
winstrol
 
Posts: 30
Joined: Fri Jul 24, 2009 9:57 pm

Re: Start Newton on the iPhone

Postby Julio Jerez » Fri Aug 14, 2009 7:55 pm

forces are added int the force and torque callback.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Start Newton on the iPhone

Postby winstrol » Mon Aug 17, 2009 9:29 am

yeah, thank you !
if somebody wants an example here it is:
one external function before "CreateScene":
Code: Select all
void callbackSimpleMove (struct iNewtonBody* body)
{
   iNewton* world;
   world = GetWorld();
   float force[3];
   
   force[0] = 50.0f;
   force[1] = 0.0f;
   force[2] = 0.0f;
   [world BodyAddForce :body :&force[0]];
}

and calling this function inside CreateScene:
Code: Select all
[world BodySetForceAndTorqueCallback :frownyBody :callbackSimpleMove];


but I've got warning after that call "warning: passing argument 2 of 'BodySetForceAndTorqueCallback::' from incompatible pointer type"

>>>>> and I saw another problem, I wanted just add force, but in that way gravity force dissapearing, how can I just add the force, not set ?



BTW
1> if I want to steer the body be touching the scrren should I use WorldUnfreezeBody(newtonWorld, bodyToBeSimulated); as well ?
2> any news in iPhone tutorials ?
User avatar
winstrol
 
Posts: 30
Joined: Fri Jul 24, 2009 9:57 pm

Re: Start Newton on the iPhone

Postby mlfarrell » Thu Aug 26, 2010 5:21 pm

Hey guys. For those of you hitting your heads over switching .a files between iphone emulation and iphone device. I've found that using the "lipo" command can merge two library architectures into a single universal library file. Thus, one .a file for both iPhone simulator and device during debugging time. Be sure to link against iphone_device libs during final build however to save executable space.

Code: Select all
 lipo -create libnewton_iPhone* -output libnewton_universal.a
 lipo -create libJointLibrary_iPhone* -output libjointlibrary_universal.a
mlfarrell
 
Posts: 14
Joined: Mon Aug 23, 2010 3:39 am

Re: Start Newton on the iPhone

Postby Julio Jerez » Thu Aug 26, 2010 5:37 pm

Oh good to know.

can it be set in xcode?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Start Newton on the iPhone

Postby mlfarrell » Thu Aug 26, 2010 8:15 pm

Julio:

yes. After running lipo to generate the new libs. Delete the old .a's (delete references only) from the "newton" folder of the iphone project under xcode, then replace with the universal .a's by dragging them in.
mlfarrell
 
Posts: 14
Joined: Mon Aug 23, 2010 3:39 am

Re: Start Newton on the iPhone

Postby martinsm » Fri Aug 27, 2010 3:48 am

mlfarrell wrote:Be sure to link against iphone_device libs during final build however to save executable space.

I doubt that executable for ARM will include x86 portion of library created with lipo (and in other direction to x86 -> ARM). Afaik executable will include only code meant for it's architecture, so there is not problems linking to universal library. Take into consideration that during installing application on device xcode runs strip command on executable stripping it's size even more (unneeded debug code/symbols/etc..)
martinsm
 
Posts: 86
Joined: Mon Dec 19, 2005 3:15 pm
Location: Latvia

Re: Start Newton on the iPhone

Postby Matic » Sat Apr 09, 2011 4:02 am

Has anyone successfully compiled source for use with iOS SDK 4.3? I got over 1000 error but I do not know how to start fixing them. I have also tried to find documentation for compilation on Mac but unsuccessfully. Could somebody please help?
Thanks!
Matic
 
Posts: 15
Joined: Fri Apr 08, 2011 8:23 am
Location: Ljubljana, Slovenia

Re: Start Newton on the iPhone

Postby Julio Jerez » Sat Apr 09, 2011 8:14 am

you need to open project C:\Users\Julio\Desktop\newton-dynamics\coreLibrary_200\projets\mac\OS10_xcode3.2.5 in xcode and add an Iphone Target,
then on that target you need to add the preprocessor _MAC_IPHONE, and it should compile fine provided you have the Iphone SDK, (mine expired and last time I tried nothing worked)
after that compile and you will have the Iphone library,

then you can take the Iphone ojective C files from the Iphone tranlator forder. C:\Users\Julio\Desktop\newton-dynamics\coreLibrary_200\projets\mac\iPhoneTranslator
each time the Newton.h file is modified you need to run Iphone Tranastor project to recreate the Objective C wraper, but I beleive that current one is still valid.
and that is all.
My guess is that you had those errors because you did not add the _MAC_IPHONE define as a Preprocesor
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 30 guests

cron