Group Group Group Group Group Group Group Group Group

Ch 15 triple buffering index error

In chapter 15 when you start applying triple buffering we have to place the following code in the update(deltaTime) function.

uniforms[currentUniformIndex].projectionMatrix = camera.projectionMatrix
uniforms[currentUniformIndex].viewMatrix = camera.viewMatrix
currentUniformIndex = (currentUniformIndex + 1) % Scene.buffersInFlight

after this we change our call to terrain.update() to

terrain.update(viewMatrix: uniforms[currentUniformIndex].viewMatrix)

but then our currentUniformIndex is already updated to a new value so I don’t think we access the correct viewMatrix as it’s lagging one uniforms entry behind.

1 Like

you are right, the index update line should be at the end of the update(deltaTime) method. we’ll be fixing that in the next version update. thanks for catching that up!

Just curious if we’ll get notified somewhere when a version update comes out. Thx.

@cocheret The digital edition, depending on the number and severity of errata may not be updated until next year. If you’re on the RW mailing list and purchased this edition, my guess (but no guarantee as I’m not in that area) is that you’ll be notified.