PDA

View Full Version : newbie question about Mach-O and OpenGL/GLUT



01-15-2003, 09:21 AM
Using CodeWarrior 8 I have no problems compiling a double-clickable OpenGL GLUT app that I wrote in C for Carbon. But I want to compile the app, not using the Carbon CFM object format, but Mach-O object format, so that I can start the program from the Terminal and use third-party libraries in the .a (archive of object files) format.

Problem is, where are the Mach-O libaries for Open-GL and Glut? They're not in Open GL SDK 1.2, or in /usr/lib. I see frameworks in /System/Library/Frameworks for:

GLUT.framework
OpenGL.framework

but the problem is that I only know C, and not C++, so I'd rather just use #include and be done with it...

Can anybody point me in the right direction with this? Thanks...

OneSadCookie
01-15-2003, 11:19 AM
Eh?

Rather than your CFM OpenGL, GLU and GLUT libs you need the OpenGL, GLUT and Cocoa frameworks.

Rather than including <GL/gl.h> and <GL/glut.h>, you need to include <OpenGL/gl.h> and <GLUT/glut.h>.

None of the rest of your code need change.

01-15-2003, 02:29 PM
Thank you very much OneSadCookie...it works great!! Really appreciate the help...

For those of you out there like me who don't really know what a framework is, this worked for me:

In CW:
1) select Project --> Set Default Target --> Mach-O C Console Final
2) click on the Frameworks tab
3) select Project --> Add files
a) navigate to /System/Library/Frameworks
b) just like OneSadCookie says, choose the OpenGL, GLUT, and Cocoa frameworks.
c) de-select the checked boxes for classic and carbon when the dialog box comes up asking which targets you want to add the frameworks to

01-15-2003, 04:02 PM
...Hmm, maybe I spoke too soon:
Somehow the GLUT left, middle, and right mouse buttons have disappeared (they don't appear in the menu bar as they do for a Carbon console). Is there a quick fix for this?

OneSadCookie
01-15-2003, 04:53 PM
Use the left, middle and right mouse buttons, respectively http://www.opengl.org/discussion_boards/ubb/wink.gif

If you don't have a 3-button mouse, I believe you can use ctrl-click instead of right-click, and option-click instead of middle-click. Not entirely sure, though.

01-16-2003, 06:57 AM
Sorry, I should have been more specific:
The popup menu/submenus associated with each of the buttons don't appear (the Right, Left, and Middle buttons certainly still do work when you ctrl-click, opt-click, etc.)
Thanks.

OneSadCookie
01-16-2003, 11:04 AM
They're working for me on 10.2.3...

01-29-2003, 05:09 PM
You're right...upgrading to 10.2.3 works. Thanks.