App to go with Red OpenGL book
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?
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.
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.
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.
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.
arekkusu Wrote:Saying something "never works" and expecting useful responses never works, too.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.
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.
DudetheCreator Wrote:I've tried Cocoa Application (in xCode) and in never works.Emphasis added.
[Cue Led Zeppelin Chorus]Communication Breakdown, It's always the same,
I'm having a nervous breakdown, Drive me insane![/singing]
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.
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.
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.
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.
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.

