Question

I would like to be able to go through a lesson on OpenGL so that I may learn to use OpenGL. This means that I need to be able to compile and run the programs myself, so that I may play around with them and begin making my own OpenGL projects. I can't do this if I can't install and include libraries that the lesson is using. So, I need either:

  • a lessons with instruction, for OSX, on how to install the libraries that the lesson uses

  • a lesson that only teaches with the libraries that come with OSX (GLUT and OpenGL).

From what I have seen around the web, it appears that GLEW is the most used library with these lessons so instruction on how to install that would be top priority. However, if there is another lesson that uses another library and you know how or have a link on how to set that library up for Mac, I would see that as a helpful answer.

Finally, overall, I would appreciate it if someone could tell me how they have their Mac set up with OpenGL, or point me to a tutorial that works with Macs.

Here are the tutorials I have been looking at:

I have been able to get the headers GLUT/GLUT.h and OpenGL/gl.h which I think are OpenGL's main header files so, alternatively, if there is a lesson out there that only relies on these two headers (or any headers in the GLUT.framework or the OpenGL.framework included with OS X Lion) that would work just fine for me.

Was it helpful?

Solution

To install most needed development libraries for os X, install fink and then use fink to install everything else:

Fink

Fink Glew page

As an added bonus here are some GLUT tutorials (although for an older version of Xcode).

OTHER TIPS

I'm not sure this is what you need but i'll give you the basics for running an opengl/glut-based program using Xcode.

  1. Create a new empty project, name it whatever you want
  2. Under the project menu click "New Target"
  3. On the left menu select "Cocoa", then click "Application", name it whatever you want
  4. You should have a new window called "Target 'your-program's-name' info"
  5. Under the tab "Build" scroll all the way down to "GCC_PREFIX_HEADER", double click the value (wich should be something like "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h", delete this line, click ok.
  6. Close the info window
  7. Right click your project's name, click Add > Existing frameworks > Select "OpenGL.framework", click add.
  8. Again, right click your project's name, click Add > Existing frameworks > Select "GLUT.framework", click add.
  9. Right click your project's name, click Add > New File > under the "C and C++" tab, select C++ file, click next, name it whatever you want. (make sure it's being added to your project and target), click finish.
  10. You're now ready to build and run any c++ project using OpenGl.framework and GLUT.framework

-You can use command + enter for building and running and command + shift + enter for closing an active window.

-When you require input from the user you should run it from terminal, compile like this:

"gcc -o func2d func2d.c -framework carbon -framework OpenGL -framework GLUT"

where func2d is the name of your application executable and func2d.c is the c file used

The imports required in case you don't have them are:

OpenGL/gl.h
OpenGL/glu.h
GLUT/glut.h
stdlib.h
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top