PDA

View Full Version : How to get started on mac os x?



Jonnex
10-18-2006, 06:13 AM
Hi,

I've recently started programming in Open GL at my university, and there we do it on linux, using the terminal to compile the code we write in some text editor.

I'd like to set up a similar thing at home on my Mac, so I downloaded the xcode pack from Apple, thinking this might help. But I've tried running some of the code I'd written at uni, and it doesnt compile, comes up with tons of errors..

Also, we're using makefiles (I dont know much about these!) and my lecturer told me the makefile would need to be different to run on a windows box, so i assumed that it would also have to be different on mac osx.

If someone could give me a really easy stage by stage guide as to how i do this i'd be so greatful!

Thanks a lot for reading :)

Jonny

Will Damon
10-18-2006, 07:07 AM
You've gotten the first step down already, which is to download the XCode package from Apple (available here: XCode Homepage (http://developer.apple.com/tools/xcode/) )

During the install, select to install the example projects. (you can also reinstall the package and select this option if you didn't select it the first time).

Then, you can open /Developer/Examples/OpenGL/GLUT/GLUTExamples.xcodeproj

This project contains quite a few handy GLUT samples that you can study and use for understanding how to get your own OpenGL apps to compile for the Mac OS X platform.

And finally, you may find these links quite helpful:
Apple\'s online OpenGL guides (http://developer.apple.com/documentation/GraphicsImaging/OpenGL-date.html)

hope this helps get you started!
-wd

arekkusu
10-18-2006, 09:20 AM
Here's the primary differences you need to know about OpenGL on Mac OS X:

#include <OpenGL/gl.h>, not <GL/gl.h>
#include <GLUT/glut.h>, not <GL/glut.h>

Linking is different, which affects your makefile. Compiling from the commandline example:
gcc -o myprogram main.c -framework OpenGL -framework GLUT

You don't have to find the entry point for every function you call. Link against OpenGL, and it will "just work".