Getting Started with OpenGL - Mac

There are numerous Cocoa OpenGL examples here at iDG (in the source code section) and With a Y has Cocoa ports of NeHe's tutorials. On the other hand, if you wish to continue with C++, I would recommend checking out sealfin's ports. (How are those going, btw?) If you ever have a specific question about programming or OpenGL, feel free to ask away. There are some gurus that frequent the boards that seem to be living programming references (you know who you are ). Good luck! Programming can be tricky but extremely rewarding!

Ok, I've got all these files on my comptuer and no idea where to begin. Thanks for your patience so far.

I guess it would kind of help if everyone posted where they began with it all. Right now it's kind of overwhelming. The dedication is still there, and I can almost taste a beginning... but I'm really rather confused on where to start.

I guess I'm just lost!

Sure, programming can be tricky... but GETTING to the point where you can actually put in some kind of code seems to be the biggest step for me! Help!

Also, when I open Project Builder (and am going through NEHE's first tutorial), select "File>NewProject" it gives me a screen that says "empty project" as my only option... This is an empty project with no files, targets, or build styles.

Where as NEHE's tutorial says I should be able to select a "Cocoa Application"... whatever he means there.

I started with getting a good grasp on C++, and then got SDL and worked with that, and then bought the OpenGL game programming book and used SDL with it. The first thing to do is setup OpenGL and from their make a triangle and display it!! Then change the colors then rotate it and shift it ect.... Baby steps my young grasshopper!! I was the same way when I first was learning OpenGL and C++. Still got plenty to learn but who doesn't!!

Quote: Also, when I open Project Builder (and am going through NEHE's first tutorial), select "File>NewProject" it gives me a screen that says "empty project" as my only option... This is an empty project with no files, targets, or build styles.

Whoa. Are you sure? That's really weird. You should see "Empty Project" at the very top, with a bunch of subheadings like "Application," "Bundle," "Framework," etc. Try reinstalling Project Builder.

Okay. How to get started with OpenGL First of all, you should read this article on setting up OpenGL in Cocoa (a notoriously hard article to find considering it's found in the *Carbon* docs). Just follow it step by step and you'll learn how to create an OpenGL View and draw things in it. After you've done that you're ready for the NeHe lessons. There's Cocoa code at the bottom of every sample that you can follow along with. Stick to the first 8 lessons until you've really got everything down.

Going through all that will probably take about two weeks for you to really learn it. Then you'll be ready for more advanced topics. Buy a copy of the OpenGL Red Book. It's value can not be overstated (though don't begin with the book). Oh, and I'd stay away from GLUT or SDL, at least at first. You're not really learning if you're letting them do all the work for you.

The hardest problem I ever had with programming was getting familiar with the tools. They are large, they are complicated, and they replace another kind of complication which exists under the surface. It took me quite a long time and a lot of different tools to finally get comfortable with the peripheral issues which are essential. Writing software requires a knowledge of the platform, especially the runtime.

It's too bad there isn't a short intro guide to the Mac OS X runtime. Apple has a big complicated one, and you might do well to skim the introduction to it: Mac OS X Runtime Architecture. Very briefly, there is language, preprocessing, compiling, assembling, and linking. You should know a little about all of those (a lot about language), although compiling and assembling is mostly automatic. Now you know why people sometimes prefer BASIC or Java or another language where much of this is hidden from you.

Another key point is libraries (or frameworks): pre-compiled code provided by the operating system or third parties which you can take advantage of using the interface, by including the correct header files and linking to the library or framework. Read the Project Builder help files to learn about linking.

Once you understand a bit about the context of writing code, you will feel much more comfortable, and can then worry about the specifics of dealing with the OpenGL framework and its conventions. That will include learning the terminology of 3D rendering and the data types and functions used to access OpenGL's rendering features.

At this point, you must simply accept that there is a minimum amount of reading, searching, head scratching and question posing in order to go from treading water to swimming. If you take your time and don't panic, you will have no problem.

Quote:Originally posted by ThrottleMonkey Also, when I open Project Builder (and am going through NEHE's first tutorial), select "File>NewProject" it gives me a screen that says "empty project" as my only option... This is an empty project with no files, targets, or build styles.

That's a new one. As Bachus said, you should see a lot of options. If you don't, perhaps you should try a different version?

Since I can run Project Builder now, if I want the OpenGL tutorials to work that are provided by NEHE, do I just cut and paste? Sure I have to add the frameworks... but when I DO cut and paste after doing all the other stuff (adding frameworks) i get a bunch of build errors. What gives?

NeHe, as I mentioned, wrote his tutorials for Windows. They will not work as is for Mac. Download the best match project file from the link at the bottom of the page. You have to decide whether to use AGL (Carbon), NSGL (Cocoa) or GLUT. I recommend GLUT. Start with the OS X GLUT tutorial, which spells everything out for you. Then continue onto the tutorials proper. There are also a ton of GLUT samples in the developer/examples/OpenGL/GLUT folder, all part of one uber-project, with which you can build a single project (recommended) or all the projects at once (not recommended).

Note on Project Builder: I strongly recommend choosing a shared build folder for projects, and not storing build products inside each project folder, especially with the samples. This will save you from some aggravations later. Read the Project Builder release notes and developer tools help topics now! Failure to heed this requirement will bring the anger of the OS X Developer gods (the Apple engineers) down upon you!

Quote:Originally posted by Bachus Okay. How to get started with OpenGL First of all, you should read this article on setting up OpenGL in Cocoa (a notoriously hard article to find considering it's found in the *Carbon* docs). Just follow it step by step

Now, the file "Green Triangle_Prefix.h" exists... but it was in the "Other Sources" group folder. Does this matter?

Since it's breaking that into two files or directories, do I need to put an underscore between "Green" and "Triangle"?

Any hints? I'll keep re-working the tutorial again and again to make sure I'm not doing anything dumb.

*** EDIT !!! ***
Ok, YES! It was the fact that "Green Triangle_Prefix.h" were separated. Apple should make note of that for n00bs like me. Oh... and BTW... I DREW A GREEN TRIANGLE!!!
*cough* ok, more like jacked some code... Back to the tutorials I go!