OpenGL / C++ compiler

Joined
May 5, 2011
Messages
54
Reaction score
0
Points
6
I need MS Visual C++ variant for Mac to run my Open GL programmes written in C++.

These are just basic programmes and not for any development purpose. I am a college student, so need to run my lab programs.

So can xcode would do ??? If yes, how ?

attaching one simple OpenGL program, if you want to test in xcode.

View attachment amk1.cpp.zip
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
Moved to more appropriate forum.

Xcode is your best bet. As to whether the OpenGL development files are included in an Xcode install, I'll have to let someone who is more familiar with OpenGL development answer that. You can get Xcode in the App Store.
 
Joined
Feb 25, 2009
Messages
2,112
Reaction score
71
Points
48
Your Mac's Specs
Late 2013 rMBP, i7, 750m gpu, OSX versions 10.9.3, 10.10
Worked just fine in XCode with only a couple of VERY minor changes...

1: #include<GL/glut.h> was changed to: #include<glut/glut.h>
2: Add frameworks OpenGL and GLUT to the build phases
3: changed void main (int argc, char **argv) to int main (int argc, char **argv) and made it return 0 at the end of the main function (it's a stickler of main returning an int value and not void)

After that I compiled and ran your code and got the image I've attached to this post...

Screen shot 2011-05-10 at 11.34.18 AM.png
 
OP
A
Joined
May 5, 2011
Messages
54
Reaction score
0
Points
6
@vansmith - thank you for moving to the right section.

@Nethfel - thanks for replying mate. I am totally new to Mac and so to Xcode. I am good in basic C / C++ so understanding 3rd part was not hard :p

But I didn't understood second part. How shall I add a framework ? Yes, I am total noob here ;) Also which option I should use, like developing for Mac app or iPhone ? Few initial steps would be appreciated :)
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
I'll have to have Nethfel correct me if I'm wrong here but you're going to want to go to Project > Add to Project... > navigate to /System/Library/Frameworks > add the GLUT.framework and OpenGL.framework folders.

Alternatively, you can right click your project > Add > Existing Frameworks > change the dropdown to Frameworks > select the GLUT.framework and OpenGL.framework options.

I think this is what Nethfel's referring to in their original post.
 
OP
A
Joined
May 5, 2011
Messages
54
Reaction score
0
Points
6
umm..not getting :(

When I open up Xcode I get four options, I chose first one, Create a new Xcode project. Later I have to chose Mac or iPhone ? I chose "empty project" in iPhone. But I don't see any option like Project or Add to project.

PS - Guys I am totally new and noob to mac, so sorry for the trouble
 
Joined
Feb 25, 2009
Messages
2,112
Reaction score
71
Points
48
Your Mac's Specs
Late 2013 rMBP, i7, 750m gpu, OSX versions 10.9.3, 10.10
Which version of XCode are you using? Currently I only have XCode4 installed on all of the systems I have access to so I want to make sure I don't attempt to give you instructions that won't work :) ...
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
I have to apologize - I have Xcode 3 and forgot to mention that earlier. Thus, it's very possible that the directions are quite different.

Here are Xcode 4 instructions.
 
Joined
Feb 25, 2009
Messages
2,112
Reaction score
71
Points
48
Your Mac's Specs
Late 2013 rMBP, i7, 750m gpu, OSX versions 10.9.3, 10.10
Hey, I whipped up a short video tutorial on how to add a framework into a project in XCode 4 - hopefully that'll clarify things for you :) you can see it here: YouTube - Adding Frameworks to XCode 4 Projects (yeah, I used the circle drawing code you were having trouble with to demonstrate)
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
Well done Nethfel! Thanks for putting that up there.
 
Joined
Feb 25, 2009
Messages
2,112
Reaction score
71
Points
48
Your Mac's Specs
Late 2013 rMBP, i7, 750m gpu, OSX versions 10.9.3, 10.10
Not a problem - hope it helps out!
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top