Sign in to follow this  
ChristophR

OpenGL MacOS X

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this