I have experience with game programming mainly in allegro or drawing everything on native windows (No graphic libraries). Now I am interested in learning OpenGL for game development. I have found several OpenGL tutorials, but right now I only want to set up my environment so that I can be able to open windows and draw on them. I use Mac OS, but I am very interested in making all of my code as cross-platform as possible, so I would like to know how to set up (download, install, make a hello world kind of thing) OpenGL on a mac, but preferably without using Xcode or Apple depending stuff. I already checked to see whether my mac supports newer OpenGL and it does, so I will try to use the most recent standards.

I am ok with writing makefiles to link libraries and that kind of stuff that usually Xcode does for the sake of portability.

I keep wondering if I will need to always write some platform specific code when creating a mainly cross-platform game... and my guess is I will, but I want to minimize it. Anyway, I would like to know your advice for me. I hope my question is clear, but feel free to ask any detail you might need to know.

  • 1
    \$\begingroup\$ I would start looking into GLFW for window management and GLEW for a better interface to modern GL. Also, this site has a lot of tuts for linux, which you can easily convert to OSX (and learn a lot of useful stuff about portable code in the process!) \$\endgroup\$
    – glampert
    Dec 9, 2014 at 2:08

1 Answer 1


I wrote this longish list of notes about cross platform stuff, but by the end I realized that @glampert's advice for GLFW is probably perfect.

I'll post this, anyway, maybe it is useful.

You can separate the concepts of “code portability” and “project portability”, though sometimes they go hand-in-hand.

Plenty of cross platform development efforts will use cross platform libraries, but just accept the hit of maintaining the separate projects & build systems, so that development & debugging can happen in the best local IDE.

You can certainly build Mac executables with gcc and make. The switches will differ slightly on Mac from Linux (for -framework and such), and needs 3rd party help like Cygwin to work on Windows.

The tool CMake will generate Visual Studio and XCode projects, as well as makefiles, from a single project description. (Although it’s kind of a quirky sometimes stubborn tool, it works.)

For code portability, you could use GLUT, or the more modern GLFW, or SDL2, or SFML to abstract out basic user input and window and OpenGL context management.

Another approach could be to use Eclipse IDE & Java, which presents a quite nice IDE which is the same on all platforms, and really “just works”. (A Java executable “jar” file needs a tiny launcher on each platform, but it’s trivial.) In Java you can use JOGL bindings to OpenGL. Opinions vary on whether performance differences between C++ and Java exist or matter…

And of course you could use a high level tool like Unity, which offers turnkey cross platform builds, but you're pretty distant from OpenGL at that point.

I think the shortest path to get up and going and have some fun with glDrawXxx is probably XCode project and GLUT (or GLFW?), and know that it won't be hard to write a Makefile to replace your Xcode project if you want.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .