Discussion:
Any Good online tutorial for Carbon Programming ?
(too old to reply)
B Thomas
2006-02-16 23:42:24 UTC
Permalink
Hi,

Could you kindly point me to any good tutorial for programming
user interfaces and OpenGL applications for Mac OS X using C and
the Carbon API. I am not a Mac User but am planning on writing some code
for multiple platforms (including Mac).

sincerely
B Thomas
David Phillip Oster
2006-02-17 04:48:33 UTC
Permalink
Post by B Thomas
Could you kindly point me to any good tutorial for programming
user interfaces and OpenGL applications for Mac OS X using C and
the Carbon API. I am not a Mac User but am planning on writing some code
for multiple platforms (including Mac).
It is pretty old (pre-HIView), but you might try:

<http://www.mactech.com/macintosh-c/online.html>
Alwyn
2006-02-17 08:30:29 UTC
Permalink
Post by David Phillip Oster
Post by B Thomas
Could you kindly point me to any good tutorial for programming
user interfaces and OpenGL applications for Mac OS X using C and
the Carbon API. I am not a Mac User but am planning on writing some code
for multiple platforms (including Mac).
<http://www.mactech.com/macintosh-c/online.html>
That book is so old-fashioned that I would find it very hard to
recommend it to anyone. It doesn't cover Carbon Events, let alone HIView.

Apple's *Learning Carbon* is the basic book I'd recommend, but it dates
back to 2001, and again there is no HIView.
<http://www.oreilly.com/catalog/learncarbon/>

The OP might also care to have a look at *Mac OS X Programming* by Dan
Parks Sydow; again, this is of the same vintage:
<http://www.peachpit.com/title/0735711682>


Alwyn
Alwyn
2006-02-17 18:05:07 UTC
Permalink
In article
Post by Alwyn
Post by David Phillip Oster
<http://www.mactech.com/macintosh-c/online.html>
That book is so old-fashioned that I would find it very hard to
recommend it to anyone. It doesn't cover Carbon Events, let alone HIView.
I was a little harsh; he does introduce Carbon Events in Chapter 17.
However, NIB files are ignored altogether, as is the possibility of
producing Mach-O executables. The author writes:
'This book, then, is for those who wish to learn to create applications
that will, firstly, run on both Mac OS X and Mac OS 8 and 9 and,
secondly, take advantage of Mac OS X's unique features when run on that
system. It is intended as a reasonably comprehensive entry point to
programming the Macintosh using the Carbon API.'
Seen from that perspective, the work is a thoroughly creditable effort.


Alwyn
Uli Kusterer
2006-02-17 13:10:41 UTC
Permalink
Post by B Thomas
Could you kindly point me to any good tutorial for programming
user interfaces and OpenGL applications for Mac OS X using C and
the Carbon API. I am not a Mac User but am planning on writing some code
for multiple platforms (including Mac).
Hi,

others have pointed out Carbon tutorials, but I thought I'd mention one
thing: If your main reason for Carbon is that you want to use C or C++,
you can also use Cocoa. MacOS X's GLUT implementation is written in
Cocoa, and Objective C is a real superset of C, and there's something
called "Objective C++" that lets you easily mix ObjC and C++ code in a
single file in a very natural way.

I'd generally recommend doing new development in Cocoa, especially if
you need a Mac GUI. Carbon is mainly good for doing low-level and
backend work, or if you need very fine file system manipulation.

Cheers,
-- Uli Kusterer
http://www.zathras.de
B Thomas
2006-02-17 18:04:32 UTC
Permalink
While I myself know C++ another developer, prefers C and
so we have decided to use C. The Mac developer site states that
Carbon is its API for C an Cocoa for C++ so we choose Carbon.
Our needs for a GUI are minimal . The application is essentially
a scripting language for mathematical graphics based on OpenGL.
So all we need is an OpenGL canvas (for 3D) and a native Canvas
for 2D. We would have used some middle ware like WxWidgets if
the GUI part was intensive. However since this is not the case
we wanted to keep dependencies to a bare minimum. This is also
the reason why we are avoiding things like Tcl/Tk. Code wise
this is not a large application so I am unsure if the
overhead of oject creation/destrustion is worth the benifits
of OOP. Though ofcourse we plan to keep our interfaces clean :).

There are other similar GUI based applications but only one I
am aware of that functions almost like a scripting language. It is
called Dynagraph and is based on the Xforms library. Hence
needs an Xserver running (see www.math.umbc.edu/~rouben/dynagraph)
What I am trying to do is reimplement Dynagraph using Win32/Carbon/Xlib
so that it runs using the native libraries making it easier
to install. Currently Dynagraph is a pain to install on windows
using Cygwin and I have not been able to try it on a Mac.

regards
b thomas
Post by Uli Kusterer
Post by B Thomas
Could you kindly point me to any good tutorial for programming
user interfaces and OpenGL applications for Mac OS X using C and
the Carbon API. I am not a Mac User but am planning on writing some code
for multiple platforms (including Mac).
Hi,
others have pointed out Carbon tutorials, but I thought I'd mention one
thing: If your main reason for Carbon is that you want to use C or C++,
you can also use Cocoa. MacOS X's GLUT implementation is written in
Cocoa, and Objective C is a real superset of C, and there's something
called "Objective C++" that lets you easily mix ObjC and C++ code in a
single file in a very natural way.
I'd generally recommend doing new development in Cocoa, especially if
you need a Mac GUI. Carbon is mainly good for doing low-level and
backend work, or if you need very fine file system manipulation.
Cheers,
-- Uli Kusterer
http://www.zathras.de
Chris Hanson
2006-02-17 19:14:13 UTC
Permalink
Post by B Thomas
While I myself know C++ another developer, prefers C and
so we have decided to use C. The Mac developer site states that
Carbon is its API for C an Cocoa for C++ so we choose Carbon.
Cocoa is not a C++ framework, it is an Objective-C framework. You can
use C++ code in a Cocoa application, but Cocoa itself is not C++.

-- Chris
Reinder Verlinde
2006-02-17 19:19:09 UTC
Permalink
Post by B Thomas
While I myself know C++ another developer, prefers C and
so we have decided to use C. The Mac developer site states that
Carbon is its API for C an Cocoa for C++ so we choose Carbon.
Where do you think you read that? Carbon has a C interface, Cocoa an
Objective-C one. Objective-C definitely is not C++.
Post by B Thomas
Our needs for a GUI are minimal . The application is essentially
a scripting language for mathematical graphics based on OpenGL.
So all we need is an OpenGL canvas (for 3D) and a native Canvas
for 2D.
For something like that you do not want to learn Carbon. You should use
a framework that hides complexities from you. Cocoa is such a framework.
It will give you (almost, if your standards are high) your entire UI
without writing any code. I think you should build your engine in
standard C or C++. Interfacing that to a Cocoa front-end is really
simple.

Reinder
Uli Kusterer
2006-02-17 23:19:49 UTC
Permalink
Post by B Thomas
While I myself know C++ another developer, prefers C and
so we have decided to use C. The Mac developer site states that
Carbon is its API for C an Cocoa for C++ so we choose Carbon.
It certainly doesn't state that. Cocoa is for Objective C, which is
something completely different from C++. Not to mention that both are
supersets of C (well, C++ isn't quite a superset of C, but you can read
Stroustrup's book if you care about those details), so you can still use
either of them for the GUI and write your portable backend code in C.
Post by B Thomas
Our needs for a GUI are minimal . The application is essentially
a scripting language for mathematical graphics based on OpenGL.
So all we need is an OpenGL canvas (for 3D) and a native Canvas
for 2D.
Okay, in that case you can use Carbon. That is, unless there's a remote
possibility your GUI needs may ever become more complex.
Post by B Thomas
We would have used some middle ware like WxWidgets if
the GUI part was intensive.
You're not using them, but just to keep you from being disappointed:
Don't use cross-platform GUI toolkits. They all provide only a
superficial platform-native GUI. Most of them look native these days,
but none of them provide native GUI "feel" on all platforms (which isn't
surprising, considering platform differences). You'd only frustrate your
users because the app doesn't behave the way they expect based on
experiences with all other apps on their system, and thus it'll seem
inexplicably broken.
Post by B Thomas
However since this is not the case
we wanted to keep dependencies to a bare minimum. This is also
the reason why we are avoiding things like Tcl/Tk. Code wise
this is not a large application so I am unsure if the
overhead of oject creation/destrustion is worth the benifits
of OOP. Though ofcourse we plan to keep our interfaces clean :).
The overhead of OOP is generally negligible. Don't fall into the trap
of premature optimisation.

HTH,
-- Uli
http://www.zathras.de
David Phillip Oster
2006-02-18 16:07:42 UTC
Permalink
Post by B Thomas
Our needs for a GUI are minimal . The application is essentially
a scripting language for mathematical graphics based on OpenGL.
So all we need is an OpenGL canvas (for 3D) and a native Canvas
for 2D.
Consider using GLUT, cross platform, open source, simple windowing
package for OpenGL, that lets you put a canvas in a window and hand it
keyboard, mouse and other device events (knobs, joysticks, button boxes.)

On Macintosh, be sure to look in the /Developer/Examples/OpenGL folder
and compile and run the examples, to help you make your decision (You
may find one that would serve as a good basis for your task.)

Loading...