MacOS X

Started by
7 comments, last by etothex 18 years, 4 months ago
Hi! Does anybody know a good tutorial about OpenGL under MacOS X and Carbon (not Cocoa)? Thanks in advance. rgds.
Advertisement
here is a xcode glut tut: http://onesadcookie.com/Tutorials
i have good cocoa templates but....

why carbon?
I don't know of any tutorials but Apple have a number of sample openGL apps here:

http://developer.apple.com/samplecode/GraphicsImaging/idxOpenGL-date.html

for example:

http://developer.apple.com/samplecode/GLCarbonAGLFullScreen/GLCarbonAGLFullScreen.html
http://developer.apple.com/samplecode/GLCarbonCGLFullScreen/GLCarbonCGLFullScreen.html

Apple's developer sample code is pretty good to learn from, provided you're happy to work on it with the documentation to hand to look up definitions, refererences, etc.. It's particular useful if you work your way through it an API at a time, so if you already know OpenGL either of the above would be a good place to start.
John BlackburneProgrammer, The Pitbull Syndicate
What I think he is looking for is the Carbon-specific implementation of an OpenGL context and window. Everything else (related to OpenGL) is pretty much universal. Sadly, there aren't many tutorials specifically covering this topic. In fact, I can't find any. So the next best thing would be sample-code and other people's code. Apple's developer website almost definitely has sample-code related to what you're looking for. Apple recently did some renovation to the site so I can't find the link for you.

What you're looking for are articles related to the "CGL" and "AGL" ("Core GL" and "Apple GL") APIs. Both are accessible from Carbon given you have the appropriates frameworks included in your project. Personally, I use AGL for all of my OpenGL apps, but if you need a lower-level API, then use CGL. AGL is built on top of CGL.

This is just my opinion (based on some fact): Don't use GLUT unless you are using it for prototype/educational purposes. Also, if you are planning on building any type of "high-performance" application, make sure the "high-performance" sections of the code contain no Cocoa calls - these will generate intense overhead in a real-time situation and will definitely slow down your program. Using NSOpenGL/Cocoa to setup your context/window is perfectly suitable.
http://blog.protonovus.com/
Apple's APIs have very little documentation online - i guess you have no choice but to buy a book if you really want to understand how the api works
The AGL documentation is here

AGL is a higher level API that evolved from OS 9. CGL is a lower level interface, written more in the style of CoreGraphics.

Contrary to what has been posted previously, GLUT is a very usable API as long as user input and window-system interaction requirements are simple. It imposes virtually no performance penalty, as long as you're not doing something silly like trying to benchmarking a rotating cube.

I also do not agree that Cocoa imposes nearly the overhead that Swordfish implies, unless it is being misused in some way. I'm curious what test case you can cite to back that up.
GLFW (http://glfw.sourceforge.net) is really good and simply for OS X. It's implemented with Carbon/AGL.

onesadcookie as mentioned above has about the only samplecode found on the internet for all OpenGL OS X alternatives...

/.tnan
what are the advanteges of GLFW against GLUT?
GLUT was never meant for anything more than demos and prototyping. While GLUT is useful, you will find that as your app becomes more complex you will need more control and flexibility than GLUT provides. Then it is time to switch to GLFW or SDL for cross-platform dev.

This topic is closed to new replies.

Advertisement