|
Q: How can I use GLUT on Mac OS X?A: GLUT is available on Mac OS X through the GLUT framework. It is installed with every install of Mac OS X. For more information about frameworks, please see Introduction to Framework Programming Guide. Note: Although GLUT is available on Mac OS X, Apple recommends OpenGL developers use the Cocoa-based NSOpenGL classes for window creation, because the NSOpenGL classes provide interfaces to other APIs on Mac OS X such as Core Image, Core Animation, etc. To use GLUT on Mac OS X, you need to include the OpenGL and GLUT headers in a form of #include <OpenGL/gl.h> #include <OpenGL/glu.h> #include <GLUT/glut.h> You also need to link your project to the OpenGL and GLUT frameworks. If you are using Xcode to build your project, select Add to Project under the Project menu, then select and add If you want to build your project from the command line or a make file, link the frameworks as shown in the following listing. cc -framework GLUT -framework OpenGL -framework Cocoa glutapp.c -o glutapp For a GLUT sample that builds in Xcode, you may refer to GLUTBasics. This simple GLUT example shows the use of standard callbacks and camera control. It is good starter code to base your own projects on. Cocoa-based NSOpenGL is recommended over GLUT for window creation on Mac OS X. When you are ready to move up from GLUT to NSOpenGL, please see the Cocoa OpenGL sample. This sample demonstrates using NSOpenGL to setup windows for drawing and to handle user events. Document Revision History
Posted: 2008-10-13 |
|