Advertisement

mac osX + openGL + c++

Started by February 05, 2006 05:21 AM
2 comments, last by haegarr 18 years, 7 months ago
Hi, I need help in using openGL and C++ on mac osX. in windows, ive been using visual studio. how do i do so on a mac? and also having the same libs and etc. please help!! thanks.
Apple ships is own IDE named XCode. It supports at least C, C++, ObjectiveC,a nd ObjectiveC++ (what is a combination of ObjectiveC and C++).

OpenGL is the native 3D API on MacOS X. The pathes to header files will differ, so you have to work with some "#if defined". I've solved this by including an own OpenGL header that itself wraps including the necessary system headers (and also do other adaptions if necessary).

The windowing system is totally different, of course. Perhaps you are using GLUT, then all is the same. Otherwise you have to deal with AGL (instead of WGL) for creating OpenGL contexts, but that is _logically_ all the same.
Advertisement
hi, thanks for the reply...
but is it possible to be less technically please??

because i dont quite get the techincal part...
Well, the stuff is actually technical. However, I could explain it more verbosely. Hope it will help you:

XCode is an IDE (integrated development environment). It is a GUI based tool intergating an editor (normally with syntax highlighting, term completion, and such stuff), make utility, compiler, and linker (all tools that make the executable from the sources).

Apple ships MacOS X with XCode included. XCode supports the programming languages C, C++, and ObjectiveC, the latter being the language one of MacOS X's system APIs is written in (you may know the keywords Cocoa and Aqua). Perhaps XCode supports also Java?!

There are other IDEs like CodeWorrier (commercial) and also other languages (like some Basic dialects) available.

OpenGL is one of the modern MacOS X's fundaments. It is also shipped commonly with MacOS X. But the access pathes of the header files and libraries will differ from those of Windows. Such stuff is usually handles by constructs like
#if defined __WIN__
#include <OpenGL.h>
#elif defined __MACOS__
#include <OpenGL/OpenGL.h>
#elif defined __linux__
#include <GL/OpenGL.h>
#elif
#error
#endif
if using C/C++/ObjectiveC.

The last point is that even OpenGL is system independent, there is a little portion needed that is _not_ system independent. That portion deals mainly with creating an OpenGL context and binding it to a window. That stuff is necessary before you could use OpenGL. Each windowing system has an own small portion doing that stuff. In Windows that is named WGL, in linux (X Windows) GLX, and in MacOS X AGL. There is also a system independent wrapper called GLUT (short for OpenGL Utility Toolkit) that is also provided by MacOS X. There are also 3rd party wrappers like SDL. So either you have to use the system dependent thing and do some few stuff yourself, or else use a ready-to-use wrapper.

This topic is closed to new replies.

Advertisement