Mar 02

The iPhone uses a special form of OpenGL known as OpenGL ES. The ES stands for “embedded systems.” It’s a scaled back version to fit on small devices (like the iPhone).

I’ve decided to teach myself Open GL first – then go through the pain of learning OpenGL ES – which means when I scale back to ES, some features I’m going to learn about may be missing.  

Even though I’m more comfortable in Windows, I’m going to make life even more complicated by learning OpenGL on the Mac first.

OpenGL on the Mac

To get started developing for OpenGL on the Mac you are going to need Xcode.  See my previous post for information on that.  I’m assuming you are using the latest version of Mac OS X.

Then what you need to do is visit this link:

http://blog.onesadcookie.com/2007/12/xcodeglut-tutorial.html

At this point you could be done.  What I’m doing here is taking my notes from that article and compressing them.  In a few places I did things a little differently.  But in each case the goal was met:  have a working project that will compile OpenGL and GLUT code.

  1. In Xcode select: File / New Project …
  2. Under Mac OS X select: Other
  3. Click on: Empty Project
  4. Click: Choose …
  5. Select your development root directory
  6. Click: New Folder
  7. Give the folder the name of your project, like TestOpenGL
  8. For Save As enter the name of your project, like TestOpenGL
  9. Click: Save 
  10. Under Groups & Files right-click on Targets
  11. Select: Add / New Target …
  12. Under Mac OS X select: Cocoa
  13. Select: Application
  14. Click: Next
  15. Enter a Target Name, like TestOpenGL
  16. Click: Finish
  17. You’ll be presented with a Target “TestOpenGL” Info window
  18. Scroll to the bottom and double click: GCC_PREFIX_HEADER
  19. Clear the contents and click OK
  20. Close the Info window
  21. In the Groups & Files window of Xcode, right click on the Products folder
  22. Select: Add / Existing Frameworks …
  23. Expand: Frameworks
  24. Select: GLUT.framework
  25. Apple-key + click OpenGL.framework
  26. Click: Add
  27. You’ll see a dialog box, just use the defaults and click Add
  28. In the Groups & Files window of Xcode, right click on the Products folder
  29. Select: Add / New File …
  30. Under Mac OS X select: C and C++
  31. Select: C File
  32. Click: Next
  33. Name it main.c
  34. Click: Finish
Now you have a main.c file where you can plug in OpenGL code – including code that uses the GLUT framework – from your favorite tutorial. It should compile and run on the Mac just fine.

Tags: ,

Leave a Reply