Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

retsgorf297

macrumors newbie
Original poster
Sep 30, 2013
9
0
Hi, I have just started learning OpenGL and Obj-C, for that matter. I would like a tutorial on how to program using OpenGL and a Cocoa Application using -->OS X<--, NOT iOS. I have not actually found a tutorial like this. All most everything has been for iOS. Now this may just be my bad research skills. I don't want OpenGL ES either.

If I seemed mad, I am not, but it kinda looks like that, huh.

Thank you very much :) ,
retsgorf297
 
Before I suggest anything I wish to know what is it you wish to accomplish in learning OpenGL.

EDIT: What the heck maybe something like <http://lnx.cx/docs/opengl-in-xcode/> will appeal to you.
 
Last edited:
For OpenGL:
OpenGL Programming Guide, 8th Edition
OpenGL Shading Language, 3rd edition
OpenGL Programming for the X Window System
OpenGL Reference manual, 4th edition
OpenGL Tutorial

And for Objective-C:
Download Xcode from Mac App Store (if you haven't already)
Know the C programming language (not a must, but it helps)
Learning Cocoa with Objective-C, 2nd Edition

Edit: A quick Google search will give you many results, that is where I found all that information (and I know Obj-C and a few other languages, that is one of the books I used for Obj-C). I'm also curious as to what you would like to accomplish learning OpenGL (assuming 2D or 3D graphics)?
 
I'd suggest to directly start with OpenGL 3.2 and newer, not with legacy OpenGL.
For example, the previously mentioned websites only teach legacy OpenGL.

If you don't want to buy the OpenGL Programming Guide (make sure it's a recent one, not legacy OpenGL), I can recommend http://www.arcsynthesis.org/gltut/
One thing to mention though is that the OpenGL Programming Guide 8th Edition uses OpenGL 4.3 and gltut uses 3.3, but Mountain Lion "only" supports 3.2.
The differences aren't really big, but you'll have to google some stuff or figure it out yourself if it didn't work like the book/tutorial says.
Maybe you could just wait for Mavericks, which will support OpenGL 4.1 (and therefore OpenGL 3.3).

One more thing: I can highly recommend GLFW or SDL, even if you want to use Objective-C, because it's easier to manage your rendering loop with them.
 
I had already set it up and was able to make a triangle on it. So, I'm just starting out. I think the lazyfoo.net reference was the best. Thanks. :D
 
I had already set it up and was able to make a triangle on it. So, I'm just starting out. I think the lazyfoo.net reference was the best. Thanks. :D

You're welcome :)

It also helped me when starting out. But as I said, if you're serious into OpenGL, buy a book. Tutorials won't cut it.

And as the other guy pointed out, buy a modern book. OpenGL is known to be riddled with deprecated crud.
 
The problem with OpenGL learning in general is that there are not many good resources for learning modern OpenGL development, which gets rid of the fixed pipeline, and requires shaders to work. Although the mechanics and the graphics theory are the same, the resources are outdated and disheartening for newcomers.

That said, you don't really need a **Mac OS X** tutorial. You need a cross-platform one. Those cross-platform thingies are usually pretty good, because they get rid of the platform-specific mechanics and focus on the common basics (which is actually what you want.).

There is a very good series of tutorials, written by Tom Dalling at http://tomdalling.com/blog/category/modern-opengl/. These are by far the best I have seen, and most importantly, they are developed on OS X. This guy will not only explain you the basics of OpenGL, but will also teach you some necessary maths theory which powers the matrix transformations. His code is provided on github. Note that he has developed his code on GLFW, and he uses the previews version. The new version is slightly incompatible, but following the migration assistant in the GLFW wiki, you will have no problem.

Recommendations while developing:
  • Avoid GLUT or FreeGLUT. Seriously. They are mostly outdated, and not flexible at all. Use SDL, or, even better, GLFW to handle mouse and keyboard input
  • Invest time into maths, but not too much. It's good to know how matrix transformations are done, and how they translate into movements into the real world, but you don't have to learn by heart the calculations, etc. So while it may seem intimidating at first, you will find that it's actually really simple, and libraries such as GLM (http://glm.g-truc.net/0.9.4/index.html) will make matrices much much easier. Only then you can pay attention more to mathematics, when you begin to design your cool shaders.
  • When you are confident enough to understand about OpenGL and graphics concepts, I advise you not to develop a game engine yourself, but to use an existing one. If you want more flexibility than a game engine can provide you with (they do have limitations, you know! :) ), use Ogre3D which is actually a rendering engine. You cannot get more flexible than that (you can mix it with practically anything for libraries, and you can also extend it with your own OpenGL code).

If you want to buy a book, do it after you have read the basic tutorial I give you, not before! Usually, books like the OpenGL Superbible are good but filled with useless and deprecated features, let alone the fact that they are using their own framework for transformations, which - if you don't know what it does - will surely confuse you as to why they use that! Not to mention that other books are filled with OpenGL features that you cannot really use (because they require an OpenGL version you don't have). So, in order to be able to cope with this stuff, read the tutorials, and learn the basics, to avoid the pitfalls of books.
 
I have gone with the lazyfoo.net link. I can interpret what it has there to my custom view. But, I am having a problem. :( What is main run loop for a custom OpenGL view.

Thanks :D
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.