Making Kinematic Bodies

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Making Kinematic Bodies

Postby Julio Jerez » Sun May 12, 2013 10:46 am

can you just open that file and comment out the line #include <Carbon/Carbon.h>

this was added automatically by the IDE back when I mad the project using xcode 2.5
but I do no think new needs that header, if it does not work later I will see if I add the path to the project.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Making Kinematic Bodies

Postby Julio Jerez » Sun May 12, 2013 10:54 am

I just made the change, this is how the newer IDE create the precompile headers
Code: Select all
//#include <Carbon/Carbon.h>
 
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#endif


please try again.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Making Kinematic Bodies

Postby Bird » Sun May 12, 2013 11:18 am

I tried again and this time it fails in dgTypes.h -----> 'error message is "new" file not found

-Bird
Bird
 
Posts: 636
Joined: Tue Nov 22, 2011 1:27 am

Re: Making Kinematic Bodies

Postby Julio Jerez » Sun May 12, 2013 12:05 pm

Ok I will try again in a moment, I have the second line installing Ubuntu on my old laptop.
this take a while because the laptop is old.

after that I will start the Mac again and see what is wrong.
I am guessing it is one of those
include <new> or include <new.h>

this is because Apple refuses now use the standard libraries like every one else does.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Making Kinematic Bodies

Postby Bird » Sun May 12, 2013 1:21 pm

I think the <new> problem was my bad. I forgot to set the Base SDK option to OSX 10.7. So now that works.

But I'm now going errors in in toolbox_stdafx.h. Error message is "stdlib.h' file not found

The CoreLibrary_300/newton.xcodeproj compiles without any problems.

-Bird
Bird
 
Posts: 636
Joined: Tue Nov 22, 2011 1:27 am

Re: Making Kinematic Bodies

Postby Julio Jerez » Sun May 12, 2013 1:39 pm

Ok I just try and compile fine here, but I still move the include to the Window and Linux section but not to the Mac
It also compiles and run, please try again.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Making Kinematic Bodies

Postby Bird » Sun May 12, 2013 2:05 pm

Julio Jerez wrote:Ok I just try and compile fine here, but I still move the include to the Window and Linux section but not to the Mac
It also compiles and run, please try again.


Making progress! This time newtonDemos.xcodeproj compiles ok but now I'm getting the linker error "library not found for : -ldContainers"

-Bird
Bird
 
Posts: 636
Joined: Tue Nov 22, 2011 1:27 am

Re: Making Kinematic Bodies

Postby Julio Jerez » Sun May 12, 2013 2:36 pm

wierd why would you get that library only, there are all part of the dependencies?

in project setting click: built-Phases->Link Binaries Libraries
there it should say 16 libraries, if you open the tab, you will find: libdContainers.a alone with all the others.

also I fixed one of the pending things, now the profilers show up when selecting from the menu. now I need to find out how to get the font.
in windows an linux this is very easy but those functions do no translate to osx, I nee to find out what openGL build wxwidget is using so that I can get the GlContext to build the font display list.
widnow and Linux have function hat simplify this, I hope mac does too..
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Making Kinematic Bodies

Postby Bird » Sun May 12, 2013 3:21 pm

It's not just the dContainers project. It looks like the paths to the Packages projects are incorrect on my machine. The path to newton.xcodeproj works but the others don't.

I noticed the the location option for Newton( which works ) is set to Relative to Group but the others like dContainers it's set to Relative to Build Products.

-Bird

Image
Bird
 
Posts: 636
Joined: Tue Nov 22, 2011 1:27 am

Re: Making Kinematic Bodies

Postby Julio Jerez » Sun May 12, 2013 3:35 pm

I noticed the location option for Newton( which works ) is set to Relative to Group but the others like dContainers it's set to Relative to Build Products.

can you try setting the path of the other library relative to group and see if it works?
Then I made that change here?

It appears that OSX do no have a way to convert a font to a display list for open GL.
Linux and windows do, I guess the only solution for this is to add the FreeType library and build my won font.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Making Kinematic Bodies

Postby JoeJ » Sun May 12, 2013 4:32 pm

Julio Jerez wrote:I guess the only solution for this is to add the FreeType library and build my won font


If you don't wanna add another complex library, you colud use bitmap font instead.
For my mobile game i used this tool: http://www.angelcode.com/products/bmfont/
That let's you choose the characters you need (ANSI, unicode, user defined...), and generates a texture and a textfile with uv and font measurement.
Function to render a string looks like this:

(If you want i can send you full source af that class, which handles reading the textfile and stuff like
placing a multiline string centered/left or right aligned in a rectangle.
I don't know which method is more work...)


Code: Select all
void BitmapFont::RenderString (const char *str, const int num)
{
   if (!str) return;
   //glEnableClientState(GL_VERTEX_ARRAY);
   glVertexPointer(2, GL_FLOAT, sizeof(Vertex), &vertices[0].x);
   glEnableClientState(GL_TEXTURE_COORD_ARRAY);
   glTexCoordPointer(2, GL_FLOAT, sizeof(Vertex), &vertices[0].u);

   float x = 0;

   for (int i = 0; i < num; i++)
   {
      float CharX = Chars[str[i]].x;
      float CharY = Chars[str[i]].y;
      float width = Chars[str[i]].width;
      float height = Chars[str[i]].height;
      float OffsetX = Chars[str[i]].xOffset;
      float OffsetY = Chars[str[i]].yOffset/* + y*/;

      Vertex *v = vertices;
      //upper left
      v->u = CharX;
      v->v = CharY;
      v->x = x + OffsetX;
      v->y = OffsetY;
      v++;
      //upper right
      v->u = CharX + width;
      v->v = CharY;
      v->x = x + width + OffsetX;
      v->y = OffsetY;
      v++;
      //lower left
      v->u = CharX;
      v->v = CharY + height;
      v->x = x + OffsetX;
      v->y = height + OffsetY;
      v++;
      //lower right
      v->u = CharX + width;
      v->v = CharY + height;
      v->x = x + width + OffsetX;
      v->y = height + OffsetY;
      
      x += Chars[str[i]].xAdvance;

      glDrawArrays (GL_TRIANGLE_STRIP, 0, 4);
   }
   //glDisableClientState(GL_VERTEX_ARRAY);
   glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm

Re: Making Kinematic Bodies

Postby Bird » Sun May 12, 2013 4:41 pm

can you try setting the path of the other library relative to group and see if it works?
Then I made that change here?


Yay!. That worked. But the app is crashing on startup.

-Bird

Image
Bird
 
Posts: 636
Joined: Tue Nov 22, 2011 1:27 am

Re: Making Kinematic Bodies

Postby Bird » Sun May 12, 2013 4:43 pm

It appears that OSX do no have a way to convert a font to a display list for open GL.
Linux and windows do, I guess the only solution for this is to add the FreeType library and build my won font.


Here's a link that might have some code to use if you decide to go this route.
http://nehe.gamedev.net/tutorial/freetype_fonts_in_opengl/24001/-Bird
Bird
 
Posts: 636
Joined: Tue Nov 22, 2011 1:27 am

Re: Making Kinematic Bodies

Postby Julio Jerez » Sun May 12, 2013 5:10 pm

Yes it look like I will have to do that method. I did no want to add more libraries but it look like there is not way around the font stuff.
I just hope freeType is not as huge as wxWidget

Oh wow, FeeType is very small and it come with VS, OSX and makefiles for Linux and a bunk other platforms.
This with that tutorial seem to be the solution to our font problems for all platforms.

I will do that next week probably.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Making Kinematic Bodies

Postby Julio Jerez » Sun May 12, 2013 7:56 pm

Ok I made all the project dependencies relative to group, just like newton.
See if it work out of the box for you now.


Crash, there?
can you highlite the tmp string, see if the word "applications" is contain on the string.
maybe it is uppercase in you system.
In any case I will change that function to read the asset form the resource archive in the bundle.
give one hour or so for that.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
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 0 guests

cron