Use shaders to draw orbits

pull/3/head
Hleb Valoshka 2019-11-14 20:14:58 +03:00
parent 5af66f9ab2
commit fbd83e5587
1 changed files with 6 additions and 1 deletions

View File

@ -1572,6 +1572,10 @@ void Renderer::renderOrbit(const OrbitPathListEntry& orbitPath,
float nearDist,
float farDist)
{
auto *prog = shaderManager->getShader(ShaderProperties::PerVertexColor);
if (prog == nullptr)
return;
Body* body = orbitPath.body;
double nearZ = -nearDist; // negate, becase z is into the screen in camera space
double farZ = -farDist;
@ -1755,7 +1759,6 @@ void Renderer::renderOrbit(const OrbitPathListEntry& orbitPath,
else
highlight = highlightObject.star() == orbitPath.star;
Vector4f orbitColor = renderOrbitColor(body, highlight, orbitPath.opacity);
glColor4fv(orbitColor.data());
#ifdef STIPPLED_LINES
glLineStipple(3, 0x5555);
@ -1770,6 +1773,7 @@ void Renderer::renderOrbit(const OrbitPathListEntry& orbitPath,
viewFrustumPlaneNormals[i] = frustum.plane(i).normal().cast<double>();
}
prog->use();
if (orbit->isPeriodic())
{
double period = orbit->getPeriod();
@ -1821,6 +1825,7 @@ void Renderer::renderOrbit(const OrbitPathListEntry& orbitPath,
glDisable(GL_LINE_STIPPLE);
#endif
glUseProgram(0);
glPopMatrix();
}