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

mbabauer

macrumors regular
Original poster
Feb 14, 2006
105
0
I am going to start playing with OpenGL, so I've downloaded the samples from the Apple site. I did have a question, however...is it advisable to write a custom component for Interface Builder to display the OpenGL output, using GLUT, or is there a better approach? Most of the sample code doesn't use NIFs at all, in lue of using Carbon components directly from the code. Also, most of the sample code is in C/C++...is Objective-C not optimized enough for OpenGL to be practical?
 

slooksterPSV

macrumors 68040
Apr 17, 2004
3,544
306
Nowheresville
OpenGL Is C/C++ - there isn't an Objective-GL or Objective-OpenGL (wish there was), but you could make your own objective-c library for OpenGL.

GLEnable(GL_LIGHTS)
you could make the function
[GLFunction glEnable:[GLItem GL_LIGHTS]] or
[GLFunction glEnable:GL_LIGHTS]
It'd be pretty simple, just take a while cause there is: GLFloat GLInt, etc. etc.
 

mbabauer

macrumors regular
Original poster
Feb 14, 2006
105
0
Thanks

Palad1 said:
Hello,

Last time I checked, there's a class which already does all the dirty glut work in the Cocoa Framework. Check NSOpenGLView out

Thanks, I think this is what I was looking for.

As a side note, most of the sample code says it comes from some "Orange Book". What is this Orange Book, do I need it, and where do I get it? I did some 3D stuff, including OpenGL and even built my own raytracer in College many, many years ago, but I am sure its all different now.
 

Soulstorm

macrumors 68000
Feb 1, 2005
1,887
1
mbabauer said:
Also, most of the sample code is in C/C++...is Objective-C not optimized enough for OpenGL to be practical?
Objective C is a pure Superset of C (unlike C++), so, the same things you can do with Objective C, you can also do with C.

And it's not that Objective C is not optimized for OpenGL... It's that OpenGL wasn't written to take advantage of all the capabilities of Objective C.
 

Palad1

macrumors 6502a
Feb 24, 2004
647
0
London, UK
Well, OpenGL is a procedural library. Sometimes it's just nice to stop working with classes & get back to structs and pointers ;)
 

mbabauer

macrumors regular
Original poster
Feb 14, 2006
105
0
Palad1 said:
Well, OpenGL is a procedural library. Sometimes it's just nice to stop working with classes & get back to structs and pointers ;)

Yeah, I am WAY rusty on those, though. I have been primarily a Java developer for work, and all those C/C++ and assembler things I learned in collage have quite a few cobwebs on them.

But, as I always say, and have proven time and time again, once you know one language you pretty much know them all...its a matter of learning the new syntax and the quirks, and doing a LOT of googling :D .

BTW, whats the actual title of the "Red Book" and the "Orange Book". Oh, and authors would be great...makes it easier to find on Amazon.
 

Palad1

macrumors 6502a
Feb 24, 2004
647
0
London, UK
iirc, red book is 'opengl programming guide', orange is 'opengl shading language'.

just google or wikipediate them.

(yeah, I now, you shouldn't verb nouns... :D )
edit:

Got them:
OpenGL Programming Guide ISBN 0321335732
OpenGL Shading Language ISBN 0321334892
 

mbabauer

macrumors regular
Original poster
Feb 14, 2006
105
0
Palad1 said:
iirc, red book is 'opengl programming guide', orange is 'opengl shading language'.

just google or wikipediate them.

(yeah, I now, you shouldn't verb nouns... :D )
edit:

Got them:
OpenGL Programming Guide ISBN 0321335732
OpenGL Shading Language ISBN 0321334892

Sweetness! You are the man/woman!

BTW: I heard Webster is trying to add google as a verb to the dictionary, which apparently google is trying to stop. So, come next release, saying "I googled it" will not be a missuse of the word at all :) .
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.