Skip to content

Commit b877634

Browse files
committed
try using a triangle-strip-based mesh to save space and possibly improve performance
1 parent d3c7545 commit b877634

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

-805 KB
Binary file not shown.

src/core/modules/Planet.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
#include <QVarLengthArray>
6363
#include <QOpenGLBuffer>
6464
#include <QOpenGLContext>
65+
#include <QOpenGLFunctions_3_3_Core>
6566
#include <QOpenGLVertexArrayObject>
6667
#ifdef DEBUG_SHADOWMAP
6768
#include <QOpenGLFramebufferObject>
@@ -5139,7 +5140,13 @@ bool Planet::drawMoon(const StelPainterLight& light, StelPainter& painter)
51395140
gl->glClear(GL_DEPTH_BUFFER_BIT);
51405141

51415142
bindMoonVAO();
5142-
GL(gl->glDrawElements(GL_TRIANGLES, model.indexArr.size(), GL_UNSIGNED_INT, reinterpret_cast<void*>(indicesOffset)));
5143+
// Use primitive restart if we support it, and accept the artifacts that will appear if we don't
5144+
if (const auto gl33 = StelOpenGL::highGraphicsFunctions())
5145+
{
5146+
GL(gl->glEnable(GL_PRIMITIVE_RESTART));
5147+
GL(gl33->glPrimitiveRestartIndex(UINT_MAX));
5148+
}
5149+
GL(gl->glDrawElements(GL_TRIANGLE_STRIP, model.indexArr.size(), GL_UNSIGNED_INT, reinterpret_cast<void*>(indicesOffset)));
51435150
releaseMoonVAO();
51445151

51455152
GL(moonShaderProgram->release());

0 commit comments

Comments
 (0)