# Ch 15 triple buffering index error

**URL:** <https://forums.kodeco.com/t/ch-15-triple-buffering-index-error/52921>\
**Category:** Metal by Tutorials\
**Created:** [October 15, 2018, 9:34am UTC](https://forums.kodeco.com/t/ch-15-triple-buffering-index-error/52921 "2018-10-15T09:34:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bababoega](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/bababoega/32/108667_2.png) [@bababoega](https://forums.kodeco.com/u/bababoega)\
**Post date:** [October 15, 2018, 9:34am UTC](https://forums.kodeco.com/t/ch-15-triple-buffering-index-error/52921/1 "2018-10-15T09:34:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mhorga](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/mhorga/32/109017_2.png) [@mhorga](https://forums.kodeco.com/u/mhorga)\
**Post date:** [October 16, 2018, 2:10am UTC](https://forums.kodeco.com/t/ch-15-triple-buffering-index-error/52921/2 "2018-10-16T02:10:54Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![cocheret](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/cocheret/32/105841_2.png) [@cocheret](https://forums.kodeco.com/u/cocheret)\
**Post date:** [November 7, 2018, 7:33pm UTC](https://forums.kodeco.com/t/ch-15-triple-buffering-index-error/52921/3 "2018-11-07T19:33:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![caroline](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/caroline/32/111867_2.png) [@caroline](https://forums.kodeco.com/u/caroline)\
**Post date:** [November 9, 2018, 6:32am UTC](https://forums.kodeco.com/t/ch-15-triple-buffering-index-error/52921/4 "2018-11-09T06:32:35Z")

</div>

@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.
