Omnimaga

General Discussion => Technology and Development => Computer Programming => Topic started by: Augs on August 14, 2013, 09:39:15 am

Title: [Help]Eclipse C++ OpenGL on a mac
Post by: Augs on August 14, 2013, 09:39:15 am
Hello, I am using a mac right now and want to use OpenGL on C++.

I use the eclipse IDE. I have already setup my C++ enviroment so don't worry about that.

So I can get to this stage: http://www.paulsolt.com/GLUT/images/Properties2.jpg

But I have no idea how to add the libraries. When I go on the OpenGL site it just says that I should use Xcode.

I can find the OpenGL and GLUT files in Xcode. But I don't know how to move them over to eclipse.


Side note: I would use Xcode for this but the only tutorial I can find for Xcode C++ with OpenGL isn't using the up to date version of Xcode.
Title: Re: [Help]Eclipse C++ OpenGL on a mac
Post by: Scipi on August 14, 2013, 11:36:29 am
Well, I know absolutely nothing about C++ in Eclipse, but I can imagine it'll be similar to other IDE's.

First, you need to install your OpenGL devkit into a directory (I suggest somewhere with no spaces in the path).

Next you'll need to go to your project settings, add the path to the include folder in your installation path as well as add the path to the lib folder in their corresponding fields. Finally, you have to define the lib files you are using.

You'll likely find the include field under "Build Settings," the lib path is in the lower field on that screen, and you can see how the libs are defined for use in the upper field.

Edit: Ensure these are done for both build configurations, debug and release
Title: Re: [Help]Eclipse C++ OpenGL on a mac
Post by: Augs on August 14, 2013, 06:03:19 pm
Thanks!

But on the site:http://www.opengl.org/wiki/Getting_started

On the mac part it doesn't offer a download and just says to use Xcode.
Title: Re: [Help]Eclipse C++ OpenGL on a mac
Post by: Scipi on August 15, 2013, 12:10:42 am
Looks like you just need to download Xcode because it comes with all the OpenGL headers. They just suggest it since it also comes with debuggers and GCC, making for easy setup. Just get Xcode, and it will install the OpenGL headers as part of it. You should be able to use any IDE for OpenGL development after that.
Title: Re: [Help]Eclipse C++ OpenGL on a mac
Post by: Augs on August 15, 2013, 07:42:15 am
Just get Xcode, and it will install the OpenGL headers as part of it.

The thing is that I'm not quite sure how to do that
Title: Re: [Help]Eclipse C++ OpenGL on a mac
Post by: Adriweb on August 15, 2013, 08:39:51 am
It's free on the mac app store.
Once installed (it may take a while to download and install), also make sure to go to Preferences -> downloads (or something like that) and install the command line tools, it's quite useful

Anyway, I believe the OpenGL stuff will become available as a framework for projects
Title: Re: [Help]Eclipse C++ OpenGL on a mac
Post by: Augs on August 15, 2013, 09:11:56 am
I have Xcode.

But the problem is that I can't get OpenGL to work with C++ on Xcode.

Title: Re: [Help]Eclipse C++ OpenGL on a mac
Post by: Scipi on August 15, 2013, 12:51:38 pm
It should be the same procedure then, go to your project settings and tell the project which .lib files you are using and where it can find them along with the include files. if it's not working in Xcode, then it's likely because Xcode does not know where the necessary files are.

Also, remember for Mac

Code: [Select]
#include<OpenGL/gl.h> //Include like this
#include<GL/gl.h> //Not like this

You may want to also look into frameworks like Cocoa, as well.
Title: Re: [Help]Eclipse C++ OpenGL on a mac
Post by: Augs on August 15, 2013, 01:40:03 pm
I looked through the OpenGL files in Xcode.

There are no .lib files. And as adriweb said it's framework.

Edit: Just to clarify. All I want to be able to do is to draw images and lines ect... with C++. To me it doesn't really matter the IDE or the library. It's just that OpenGL is apparently great.

Edit2: I have decided to use SDL. I think I have it working on Xcode. Link to the tutorial I used: http://meandmark.com/blog/2012/01/using-sdl-with-xcode-4/