PDA

View Full Version : Starting OpenGL on the Mac



toneburst
01-25-2008, 05:55 AM
Can anyone recommend resources for someone beginning OpenGL on the Mac?
I have some experience of scripting languages, but no C, C++, Obj.C knowledge. I'm not particularly interested in writing applications, but I'd like to know the basic OpenGL concepts, so that I can write GLSL shaders, and possibly at some point OpenGL-based plugins for Quartz Composer.

I already have the GLSL Orange Book, but this assumes prior knowledge of OpenGL.

Anyone and advice?


Cheers guys,

alx
Quartz Composer blog: http://machinesdontcare.wordpress.com

ZbuffeR
01-25-2008, 07:05 AM
The is always "The Red Book", an old version is online here :
http://fly.cc.fer.hr/~unreal/theredbook/
The "OpenGL Superbible" is said to be a good book too, but quite Windows-specific sometimes.

Use freeglut instead of glut and use whatever sample glut program you find on the web.

If you are not interested in writting apps, why not use a cross platform IDE such as Lumina, so you only have to worry about GLSL code itself ?
http://lumina.sourceforge.net/

Maybe this is even simpler for you, taken from wikipedia :
"GLSLEditorSample - a cocoa application running only under Mac OS X. It allows shader creation and compilation, but no debugging is implemented. It is part of the Xcode package, versions 2.3 and above."

feelgood
01-25-2008, 09:35 AM
Well if you are interested in learning about the OpenGL pipeline from a programmable standpoint (i.e. ARB_[vertex, fragment]_shader or ARB_[vertex, fragment]_program) then it would be a good idea to invest in the following text:

The "OpenGL Shading Language" by Randi Rost (i.e. what is commonly referred to as the "Orange Book")

Reading the following (online) OpenGL extension specifications:

http://oss.sgi.com/projects/ogl-sample/registry/ARB/fragment_shader.txt
http://oss.sgi.com/projects/ogl-sample/registry/ARB/vertex_shader.txt

http://oss.sgi.com/projects/ogl-sample/registry/ARB/fragment_program.txt
http://oss.sgi.com/projects/ogl-sample/registry/ARB/vertex_program.txt

As well as the GLSL language specification:

http://www.opengl.org/documentation/glsl/
http://www.opengl.org/registry/doc/GLSLangSpec.Full.1.20.8.pdf
http://www.opengl.org/sdk/libs/OpenSceneGraph/glsl_quickref.pdf

Would also be useful.

In regards to shader development tools Apple has recently updated OpenGL Shader Builder.app (borrowing a few of the more useful features from their GLSLEditorExample.app sample code) in order to make it more useful for GLSL development so I'd recommend checking this out as well (available via connect.apple.com).

In regards to general (Mac OS X) OpenGL development the following link is a good place to start (as well as a hardcopy version of the "OpenGL Programming Guide" or the "OpenGL Superbible"):

http://developer.apple.com/documentation..._section_1.html (http://developer.apple.com/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_intro/chapter_1_section_1.html)

toneburst
01-27-2008, 05:42 AM
Thanks for the suggestions, guys!

I've invested in a copy of the OpenGL Red Book, and I'm going to try working my way through that and see how I get on. I've also got 'OpenGL Programming on MacOS X', also from the OpenGL library, so those should keep me going for a while, hopefully. The problem I've found is that all the Mac-specific material assumes prior knowledge of OpenGL programming on another platform (even the stuff on Apple's own site), and most of the beginner stuff seems very windows-specific, or requires learning another programming language. I don't want to have to learn C++ or Java before I can even start to tackle OpenGL and GLSL. I do, however, need some basic background to 3D computer graphics generally, and OpenGL in particular, before I can really tackle GLSL. Hopefully I'll be able to get that from the Red Book.

ZbuffeR, do you happen to know if there's an OS X package installer for FreeGLUT? I had a look, but couldn't find one. I've had a look at 'OpenGL Shader Builder.app', that is part of the Developer Tools package. It looks handy, for testing purposes, but not so useful as a learning tool, to be honest. Lumina looks potentially a bit ore useful in this regard. I'll investigate further.

feelgood, I have the Orange Book, as it happens. That's part of the reason I was wondering if there were any other more basic sources of info out there. The Orange Book assumes a fair amount of prior knowledge of OpenGL and 3D computer graphics generally, so although I can do the projects in the book, and I'm not really getting the most out of it, as I don't really understand what's going on.

Anyway, cheers both of you for all your suggestions!

alx

toneburst
01-27-2008, 05:45 AM
Incidentally, I didn't realise I could get the Red Book for free online! Could have saved myself some money there!

It's probably better to have an up-to-date version though. That one you linked to ZbuffeR looks verrrrrrrrrry old (witness the fact that all the example 'plates' are really low colour-depth GIFs)...

Cheers again!!

alx

ZbuffeR
01-27-2008, 07:53 AM
ZbuffeR, do you happen to know if there's an OS X package installer for FreeGLUT?
Seems to be quite easily compilable from source, as explained in the last posts here :
http://www.esden.net/blog/2006/09/18/installing-cl-opengl-on-mac-os-x/

No sure if I can recommend a book on the theory on 3D computer graphics, but starting from this Wikipedia page, and following to 3d computer graphics and Graphics pipeline, etc, you will learn most important concepts :
http://en.wikipedia.org/wiki/Rendering_(computer_graphics)

Don't hesitate to post questions in the OpenGL beginner forum if you need more info.

feelgood
01-27-2008, 10:10 AM
... do you happen to know if there's an OS X package installer for FreeGLUT?
Considering that the GLUT API (via /System/Library/Frameworks/GLUT.framework) is shipping by default on Mac OS X I don't see why this would be needed.

Just make sure you #include the proper header(s) (i.e. #include <GLUT/glut.h> for example) and you proceed to link with the proper framework(s) as well (i.e. -framework GLUT passed to GCC via the command line or you can do this via Xcode's "Project -> Add To Project" option for any Xcode driven project).

toneburst
01-28-2008, 03:27 AM
Thanks once again ZbuffeR and feelgood.
Think I'll just stick with the standard MacOS X Glut for the moment. That wikipedia link you posted looks good ZbuffeR. I'll also make a start in earnest on the OpenGL Red book.

Thanks again for your advice and encouragement!

alx