f



Objective-C and C++

 I'm trying to write the, "Great American MMO" as a way to teach myself 
Objective-C. I was going to use an open source library to help with the 
3D rendering and animation. However, most of them are written in C++, 
not Objective-C. So I have a couple of questions.

 1) Is it more trouble than it is worth to try to get a C++ library 
working with an Objective-C program?

 2) What is a good reference for C++ on the Mac? (I am using the latest 
version of Xcode and Tiger, if it makes a difference.)

 Oh, if anyone has a recommendation for an open-source 3D library, I'm 
interested in that too.

-- 
  Joe Claffey                              | "Make no small plans."
  indianajoe3@comcast.net                  |        -- Daniel Burnham
0
Indiana
2/15/2006 12:54:44 AM
comp.sys.mac.programmer.help 4653 articles. 2 followers. Post Follow

1 Replies
709 Views

Similar Articles

[PageSpeed] 12

In article <indianajoe3-0F625F.19544414022006@news.giganews.com>,
 Indiana Joe <indianajoe3@comcast.net> wrote:

>  I'm trying to write the, "Great American MMO" as a way to teach myself 
> Objective-C. I was going to use an open source library to help with the 
> 3D rendering and animation. However, most of them are written in C++, 
> not Objective-C. So I have a couple of questions.
> 
>  1) Is it more trouble than it is worth to try to get a C++ library 
> working with an Objective-C program?

It is very easy to get a C++ library working in an objective-C program. 
You can write a simple C interface that returns opaque pointers to be 
held by Objective-C objects, and you can use a .mm suffix for 
Object-C++, which allows you to use both Objective-C and C++ constructs.

Some of the gotchas: Objective-C isn't compatible with C++ exceptions 
and Objective-C exceptions aren't compatible with C++. Not all 
Objective-C runtimes will automatically call C++ constructors and 
destructors for C++ objects that are fields of Objectove-C objects 
(Objective-C objects are never fields of other objects, Objective-C 
objects are always referenced by pointer.

>  2) What is a good reference for C++ on the Mac? (I am using the latest 
> version of Xcode and Tiger, if it makes a difference.)

Should be standard C++. The standard is a good reference.

>  Oh, if anyone has a recommendation for an open-source 3D library, I'm 
> interested in that too.

OpenGL is already present. Look for the NSOpenGLView examples on Apple's 
web site (in developer.apple.com in Sample Code)

Mesa is an open source library layered on top of OpenGL that provides 
higher level modelling constructs. OpenInventor is an open source 
library layered on top of OpenGL that is more tuned for high performance 
graphics. 

http://www.idevgames.com/ is a good place to learn about developing Mac 
games.
0
David
2/15/2006 3:36:33 AM
Reply: