diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/glsphere.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/glsphere.cpp b/src/glsphere.cpp index 9e721c6..feac80b 100644 --- a/src/glsphere.cpp +++ b/src/glsphere.cpp @@ -38,7 +38,7 @@ void GLSphere::makeSurface(QVector<GLPoint> *pointContainer, m_firstIndex = m_indices->size(); - for (int slice = 1; slice < m_slices - 1; slice += 2) + for (int slice = 1; slice < m_slices; slice += 2) { m_indices->append(m_firstPoint); @@ -52,10 +52,12 @@ void GLSphere::makeSurface(QVector<GLPoint> *pointContainer, for (int stack = m_stacks - 2; stack >= 0; stack--) { - m_indices->append((m_firstPoint + 1) + stack + ((m_stacks - 1) * (slice + 1))); - m_indices->append((m_firstPoint + 1) + stack + ((m_stacks - 1) * slice)); + m_indices->append((m_firstPoint + 1) + stack + (slice < (m_slices - 1) ? + (m_stacks - 1) * (slice + 1) : 0)); + m_indices->append((m_firstPoint + 1) + stack + (m_stacks - 1) * slice); } } + m_indices->append(m_firstPoint); m_nextIndex = m_indices->size(); |
