OpenGL Programming

enriquito03

Registered
I have not done much programming on my Mac except for short programs compiled through the terminal. So I'm basically a noob. I need help with compiling a GLUT/OpenGL program on my computer using Xcode 2.1.

I have read online that you need to add a framework for each GLUT and OpenGL. What is this and how do I do it in Xcode 2.1? The instructions I've found refer to an older version of Xcode. It says to go to the Project Menu and select add framework. I did not find this in Xcode 2.1.

Thanks for the help.
 

kainjow

Registered
Right-click (or control-click) a file or folder in Xcode's "Groups & Files" table on the left, and then go to Add > Existing Frameworks... and navigate to /System/Library/Frameworks, and then select GLUT.framework and OpenGL.framework (you can do multiple selections via the shift key).

Xcode 2.X has changed the command in the menubar to Add to Project, which isn't as obvious.

See attachments.
 

Attachments

enriquito03

Registered
Thanks for the help. I had found the Add to Project listing but I was looking in the wrong Library for the framework :p. Now that I have gotten the file to compile, it crashes. This source runs fine in Visual Studio, so I know it works, just have to get a few syntactical thinks write for the Mac.

I have included the libraries correctly, because the source file compiles fine. However, I do think it has to do with the opening of the text file I want to read from.

ifp = fopen( "input_filename.txt", "r" ); //open input file

(ifp is a FILE pointer)

The "input_filename.txt" file is in the Project File I created to hold the files.

Thanks for the help.
 

kainjow

Registered
To test it, put "input_filename.txt" on your desktop, and then in fopen() use the path to the file on your desktop (probably something like /Users/<username>/Desktop/input_filename.txt).
 

enriquito03

Registered
Thanks for the help. I have always stuck with using Visual Studio since it has such a great debugger, so I haven't figured out the intricasies of programming on OS X. Figured I should start learning since I got my new mac. Are there any good Xcode books I can pick up?

Also, do you know of a good set up for lighting. I just want universal lighting that will show shading on my 3D surface.

Thanks.
 

kainjow

Registered
When you compile a Mac OS X program, it usually puts files into the .app's Resources folder. Right click (Control-click) on the .app file in Finder, then go to Show Package Contents, then navigate to Contents/Resources, and see if your file is in there.

This book just came out recently about Xcode 2, supposed to be good.

Regarding your OpenGL question, I don't know enough about OpenGL to help you out there. I'd suggest you check out NeHe's webpage, they offer tons of OpenGL tutorials. Good luck!
 
Top