Errata for iPhone 3D Programming

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Not an errata, but a code example issue. In ApplicationEngine.cpp (in the texturefilter example, and others),
visuals[0].LowerLeft = ivec2(-160, 0);
should be
visuals[0].LowerLeft = ivec2(-m_screenSize.x/ 2, 0);

Note from the Author or Editor:Yes, the book should be using the passed-in screen size rather than a hardcoded size. Good catch.

Anonymous

Apr 27, 2010

Other Digital Version

1
VertexSkinning code sample, RenderingBase::GenerateBoneData

Bone generation of indexes is incorrect in the case when there are 9 matrix units (1st gen iPod) - in which case the { i0++;i1++;} code can overflow and produces '9' as a result in some cases.
The result is some vertices are skinned to the wrong position and thus a somewhat distorted stick figure.

Note from the Author or Editor:Yes, the skinning example does not work properly with OpenGL ES 1.1. Unfortunately this is due to a fundamental flaw in the code, so the fix is too involved to be conveyed here. For the second edition, we will remove the ES 1.1 variant of this sample.

This is the sentence which I think has the error.
Replace the OpenGL Initialization comment with Example 1-3.
I do not see a comment which says "OpenGL Initialization" anywhere in the previous text.

Note from the Author or Editor:On page 16, the comment that says "Initialize code..." should say "OpenGL Initialization".

Anonymous

Jul 17, 2010

PDF

Page 11
Bottom (last sentence)

You state that Apple "advises against mixing UIKit with OpenGL" - this is entirely incorrect. I'm not 100% positive that it wasn't the case when you wrote this, but at this year's WWDC, they have been very clear that taking advantage of UIKit on top of your OpenGL view is something they encourage. Can't go into too much detail because of the NDA, but there were extensive demos to get this point across.

Note from the Author or Editor:Yes, that sentence is outdated. The impact of that sentence is hopefully mitigated by the note at the top of the following page.
It's fine to mix UIKit with OpenGL nowadays, and we hope to make heavy use of this fact in the second edition.

Anonymous

Jun 09, 2010

Printed

Page 13
Note

The layer object is an instance of CAEGLLayer...
should be
The layer object is an instance of CAEAGLLayer...
(missing A)

Note from the Author or Editor:Yes, CAEGLLayer should be spelled "CAEAGLLayer".

Sorry but I posted an error in my suggested correction to the 1st and 2nd lines on page 255.
vec3 a = lines.Vertices[lines.Indices[*sourceIndex++]].Position;
vec3 b = lines.Vertices[lines.Indices[*sourceIndex++]].Position;
should change to
vec3 a = lines.Vertices[*sourceIndex++].Position;
vec3 b = lines.Vertices[*sourceIndex++].Position;

Note from the Author or Editor:Good catch! In the downloadable "AaLines" sample, sourceIndex is an integer rather than iterator, so I mixed up the listing in the book. Thanks!

Elliot

Jul 06, 2010

Printed

Page 348
Fisrt line below Figure 8-7.

OpenGL does expect it when you give it the image data for a cube map.
should read:
OpenGL doesn't expect it when you give it the image data for a cube map.

Note from the Author or Editor:Good catch Kazuya.

Kazuya Abbey

Nov 05, 2010

Printed

Page 374
3rd line from the bottom

the GPU can take the cross product of two edges
should go:
the GPU can take the dot product of two edges
because a cross product results in a vector which has no sign. The GPU should take the dot product of the two edges producing a scalar value which represents the angle between them.

Note from the Author or Editor:It's true that this sentence needs clarification, but a dot product would be incorrect. The actual correction is changing "if the resulting sign is positive" to "if the resulting sign of the Z component is positive".

Kazuya Abbey

Nov 06, 2010

Printed

Page 398
frustum function

I had posted earlier in this errata that there was a rendering difference between the ES1 and ES2 versions of the example programs, and I explained how to illustrate this difference by setting up constants for the HelloCone project that make the discrepancy more obvious. I believe I have since figured out the root of the problem. In the function listed in the appendix:
static Matrix4<T> Frustum(T left, T right, T bottom, T top, T near, T far)
The last statement should be m.w.w = 0; NOT m.w.w = 1 (as the book and online appendix state). When I made this change, the ES1 and ES2 renderings were identical, instead of there being slightly off clipping and zooming in the ES2 version.
I am almost positive that this is correct as my program confirms it. I hope the author has a chance to read this over and confirm it himself so that I can move forward from chapter 2, confident that I have made the right change!

Note from the Author or Editor:In Matrix.hpp (listed in the Appendix), change the Frustum method so that it sets m.w.w to zero rather than one.

Paul

Jul 15, 2010

PDF

Page 401
United States

There is a discussion on Stack Overflow about the function QuaternionT<T>::CreateFromVectors in the book's vector library, and whether the line with if (v0 == -v1) is in fact correct. The SO question is here: http://stackoverflow.com/questions/15355102/why-is-my-cube-distorted#comment21702236_15355102

Note from the Author or Editor:Yes, the "if" statement needs to be tweaked so that it finds a properly perpendicular axis, rather than choosing a random axis. Good catch!

sebby

Mar 12, 2013

Sign up today to receive special discounts, product alerts, and news from O'Reilly.