App to go with Red OpenGL book

DudetheCreator
Unregistered
 
Post: #1
I have the Red OpenGL book, and I was wondering, what kind of app do I put the code into? I've tried Cocoa Application (in xCode) and in never works. Will Carbon work?
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #2
Traditionally you would use GLUT, which is a cross-platform API used for basic OpenGL programs. There were some problems with GLUT on OS X in the last year or so and I don't know if the coast is clear, but that's probably where you should point your nose. Look at /Developer/Examples/OpenGL/GLUT for some examples already on your machine.
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #3
Saying something "never works" and expecting useful responses never works, too.

What doesn't work? Choosing GLUT/NSGL/AGL is mostly a matter of setup preferences. Once you have a window up, the GL code is all the same.
Quote this message in a reply
Member
Posts: 21
Joined: 2003.01
Post: #4
I've only toyed with the content of the Red Book as far as my OpenGL history goes, but I usually start with the Core OpenGL code from apple ( http://developer.apple.com/documentation...index.html ). I compile straight from the command line but I believe I have to include the Carbon headers (it's been awhile so I am not 100% sure). There is Cocoa stuff on that page too, but if I want to use cocoa I usually grab the code from http://nehe.gamedev.net in the tutorials section.
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #5
arekkusu Wrote:Saying something "never works" and expecting useful responses never works, too.

What doesn't work? Choosing GLUT/NSGL/AGL is mostly a matter of setup preferences. Once you have a window up, the GL code is all the same.
Who said "never works"? I have no idea what doesn't work, just that I know there were some buggy issues I read about last year, here on this forum. I specifically recommended GLUT because almost all of the examples in the Red Book use GLUT. That does not seem like an unreasonable recommendation to me.
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #6
DudetheCreator Wrote:I've tried Cocoa Application (in xCode) and in never works.
Emphasis added.
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #7
LOL

[Cue Led Zeppelin Chorus]Communication Breakdown, It's always the same,
I'm having a nervous breakdown, Drive me insane![/singing]
Quote this message in a reply
Moderator
Posts: 613
Joined: 2004.09
Post: #8
OpenGL Code can be used in just about anything from RealBasic to Cocoa and Carbon. If you are looking for some workable stuff to get you started i would recommend using nehe.gamedev.net cocoa/carbon xcode ports. This will give you a good start to getting things up and going on your own. But be warned his Cocoa ports have some really sub-par full screen code and will crash on you but it is a good base for what you are trying to do.

Kyle Richter
DragonForged.com
Twitter: @kylerichter
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #9
kodex Wrote:But be warned his Cocoa ports have some really sub-par full screen code and will crash on you but it is a good base for what you are trying to do.
Here's the quick fix for that.
Quote this message in a reply
Member
Posts: 196
Joined: 2002.04
Post: #10
AnotherJake Wrote:Traditionally you would use GLUT, which is a cross-platform API used for basic OpenGL programs. There were some problems with GLUT on OS X in the last year or so and I don't know if the coast is clear, but that's probably where you should point your nose. Look at /Developer/Examples/OpenGL/GLUT for some examples already on your machine.

Bugs and unsupported code? GLUT is worse in OS 10.3 than 10.1! For example, the GLUT menu items don't work in 10.3 any more, you can't use unsupported resolutions, and if you try using any screen size other than the one the system resolution is using right then sometimes the viewing screen gets moved around. For instance if I have a system resolution of 800x600 and I set GLUT to 1024x768 I get the bug.
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #11
Well, to answer the original question: you go with Carbon, Cocoa or whatever. What I suppose that you are missing is the following: GL is a way to draw stuff in a window - put simply. It doesn't give you the window, it doesn't give you any way to do input, no nothing. So, you have to create the window, then create a "context. Then, you can start inputting GL commands. Now, as the Red Book and others in this thread have suggested, go with GLUT for starters. Check out the links up in the thread and you'll find them.

The key thing to understand here is that you have to write an application around the GL, GL doesn't do very much for you in terms of getting started. Also, don't forget the headers. If you go with XCode and friends, you'll want to replace all the #include <glut.h> with #include <GLUT/glut.h> and add the GLUT framework to your project.
Quote this message in a reply
Member
Posts: 102
Joined: 2005.01
Post: #12
here is a good tutorial on how to make GLUT work in Xcode

GLUT Tutorial
Quote this message in a reply
Post Reply