diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-02-20 15:34:07 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-02-20 14:49:35 +0000 |
commit | b7f35a476caac0a0f56a04347b8d347c4eacd23c (patch) | |
tree | 99b10fbfed8edee66d7e0bf2dce71f43eef4ea67 /src | |
parent | 9e110585d8f6f99ea1d149a8f8f76d2a218d5986 (diff) |
Fix index buffer size for spheres
Fixed the calculation based on the loops below.
Having extra uninitialized indices at the end may seem harmless, but only
until encountering GL implementations that do include all index buffer
values in their validation process. With ANGLE for example the
drawElements call was often rejected due to these random, potentially
large uint16 values in the index buffer.
Change-Id: I7c54dec921961ce1bed29c30a0bfa09c91a287dd
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/render/frontend/qspheremesh.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/render/frontend/qspheremesh.cpp b/src/render/frontend/qspheremesh.cpp index 1624f5a36..7f739fa68 100644 --- a/src/render/frontend/qspheremesh.cpp +++ b/src/render/frontend/qspheremesh.cpp @@ -241,7 +241,7 @@ QMeshDataPtr createSphereMesh(double radius, int rings, int slices, bool hasTang offset += sizeof(float) * 4; } - int faces = (slices * 2) * (rings - 1); // two tris per slice, for all middle rings + int faces = (slices * 2) * (rings - 2); // two tris per slice, for all middle rings faces += 2 * slices; // tri per slice for both top and bottom QByteArray indexBytes; |