Skip to content

Commit cdb5c2d

Browse files
committed
Fix the number of triangle calculation. Fixes #127
1 parent 44bff46 commit cdb5c2d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

examples/viewer/viewer.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,8 @@ static bool LoadObjAndConvert(float bmin[3], float bmax[3],
421421
glBindBuffer(GL_ARRAY_BUFFER, o.vb);
422422
glBufferData(GL_ARRAY_BUFFER, vb.size() * sizeof(float), &vb.at(0),
423423
GL_STATIC_DRAW);
424-
o.numTriangles = vb.size() / (3 + 3 + 3 + 2) * 3;
424+
o.numTriangles = vb.size() / (3 + 3 + 3 + 2) / 3; // 3:vtx, 3:normal, 3:col, 2:texcoord
425+
425426
printf("shape[%d] # of triangles = %d\n", static_cast<int>(s),
426427
o.numTriangles);
427428
}

0 commit comments

Comments
 (0)