Sunday, December 12, 2010

OpenGL ES Book Recommendation

Since canceling my OpenGL ES 2.0 for iOS 4 book, I've had several people request book recommendations to use instead of my book. Honestly, I didn't really have one to give before today, partially because I intentionally avoided reading competing books while working on mine.

Today, while stuck on a train, I checked out Philip Rideout's iPhone 3D Programming by O'Reilly. Now, it's never easy to give an objective opinion on a book that competes with one you're writing, and even though my book is currently not on a production schedule and I have no time to work on it, I tend to still think of myself as working on an OpenGL ES book. Although there are several things that I would have done differently, I also know it's unfair to judge a book that way. Deciding what to include and what not to include in a book is a horribly difficult thing with an expansive topic like OpenGL ES and no two authors are going to make the same exact decision in that regard, so I'm not going to criticize Philip Rideout for, well, for not being me. Hell, normally not being me is taken as a bit of a compliment anyway.

Yet, though it's not the book I would have written, I can wholeheartedly recommend it. The information is solid and useful and it's presented in a way that doesn't assume or require a Ph.D in math. One thing that Rideout does do that I opted not to even attempt, is to give both the OpenGL ES 1.1 and OpenGL ES 2.0 approach to tasks that can be done in both environments, which is actually interesting on multiple grounds. One, it's a great transition for people who know 1.1 but not 2.0, but also, it shows the interesting ways people have figured out to work around the limitations of the fixed pipeline. These kinds of solutions fascinate me because they're the result of people refusing to accept technical limitations.

Much (all?) of the material from this book is available free online, but I'd recommend buying the book, which gives you access to the book's source code and also will also help an angel get his wings. Well, I'm not 100% sure on the latter, but it seems likely this time of year.

If you're floundering a bit with OpenGL ES, this book is well worth your time.



14 comments:

Carlton Gibson said...

Hi Jeff,

Thanks for the recommendation -- I've got iPhone 3D Programming in the "To Read" pile but I've been a bit scared by the apparent need for C++. (I've liked that your chapters have avoided that.)

Do you think the book is still accessible without C++, or can you recommend a quick C++ primer to get an Objective-C hand started?

TIA.
Carlton

tata Milenki said...

I must have missed something... What is the reason for cancelling OpenGL ES book?

Brad Larson said...

I second Jeff's recommendation of iPhone 3D Programming. Not only does the author do a great job of introducing basic 3-D concepts and easing you into both OpenGL ES 1.1 and 2.0, he goes into some pretty technical topics later on, like environment mapping and vertex skinning.

The only downside one could find with the book (which will be an advantage to some) is the author's reliance on C++ throughout. He gives good reasons for this, but that might give some pure Cocoa developers pause. It shouldn't, because the core OpenGL ES concepts are the same, and since OpenGL is a C-based API it doesn't really matter.

You know the author knows his stuff when his name appears in many of the common OpenGL shaders found out there as sample code (they appear to be from his time at 3D Labs).

Jeff LaMarche said...

Brad:

I'm no fan of C++ myself and disagree with some of Rideout's reason for using it, but the concepts are explained clearly and that's what's important.

Tata:

Primarily lack of time to work on it right now, combined with uncertainty over Xcode 4's release schedule.

Jeff

Jeff LaMarche said...

Carlton:

Honestly, I haven't done much C++ in 10, 12 years, so I don't have a good recommendation for a book. Probably the only thing that will really be confusing to an Objective-C programmer without C++ experience is the operator overloading.

Jeff

abackus said...

Jeff,

Thanks for something I can add to my Christmas wish list!

Carlton,

When I'm working with C++ and STL, I frequently refer to http://www.cplusplus.com/. They have a tutorial:
http://www.cplusplus.com/doc/tutorial/

I wouldn't worry too much about the C++. As Jeff says, one C++ specific feature that appears in the online version of the book (in Appendix A) is operator overloading. This basically turns an operator (for example '*') into a function call. It looks like templates are also used.
Here are the relevant sections in the tutorial for these two features:
http://www.cplusplus.com/doc/tutorial/classes2/
http://www.cplusplus.com/doc/tutorial/templates/

-Abe

Carlton Gibson said...

Abe,

Thanks for that response; exactly what I need!

warmi said...

"Probably the only thing that will really be confusing to an Objective-C programmer without C++ experience is the operator overloading."

Perhaps, but the operator overloading functionality makes 3d coding so much more intuitive, I am sure he/she will quickly start appreciating it:

It is so much easier and more intuitive to write:

local.position += (mParent->derivedOrientation().inverse() * trans)/mParent->derivedScale();

than:

Quaternion parentDerivedOrient;
mParent->derivedOrientation(parentDerivedOrient);
quaterionInverseInPlace(parentDerivedOrient);
Vector3 output;
quaterionMultiplyVector3(parentDerived,trans, output);
Vector3 parentDerivedScale;
mParent->derivedScale(parentDerivedScale);
Vector3 finalOutput;
vector3Divide(output, parentDerivedScale, finalOutput);
Vector3 finalPosition;
vector3Add(local.position, finalOutput, finalPosition);
local.position= finalPosition;

Melvin said...

I am already using the book iPhone 3D Programming for my reference and yes I agree with you that it is the book that can be recommended to people to get better programming. It's a great book.

iphone app development

Steffen Kluge said...

Concerning Rideout's book here's a tweet I posted some time agon on his quadric interpolation methods (Just in case anybody's interested in using them):

http://twitter.com/darth_steff/status/29445243398

Cheerz,
Steff

Will said...

Hi,

Have you noticed any errors in the book? I'm just beginning with it, but I noticed my Obj-C++ headers wouldn't initially compile until I wrapped the C++ portions in #ifdef _cplusplus. I think this is because, even if you explicitly tell Xcode to interpret the file as C++, it still runs over it with a plain ObjC compiler the first time, until it gets to the .mm files and reads the #import.

At least, that's been my experience. If you didn't have that problem or found a more elegant workaround, I'd love to hear it.

-Will

Will said...

BTW, I do have my own article written about the C++ code in the ObjC++ header files problem. I'd love to update it if possible, but you can get more details on it (shameless plug, but hopefully helpful) here.

Pavel said...

The only downside one could find with the book (which will be an advantage to some) is the author's reliance on C++ throughout. He gives good reasons for this, but that might give some pure Cocoa developers pause. It shouldn't, because the core OpenGL ES concepts are the same, and since OpenGL is a C-based API it doesn't really matter.


android app development
android team
android programmer
software partnership

Cheapsocceruniforms said...

There are many brand from France, also including herve leger, and most of womens stars love wearing herve leger dress when they join in some important party. Now polo ralph lauren is very popular with youthful people, everyone want to get ralph lauren polo shirts, there are lots of online shop which are ralph lauren polo outlet, true religion jeans outlet, it will be convenient for us.