Set line width according to DPI

pull/887/head
Levin Li 2020-12-01 17:34:20 +08:00
parent 21cba1eaeb
commit 22590114d1
2 changed files with 6 additions and 6 deletions

View File

@ -156,7 +156,7 @@ PlanetographicGrid::render(Renderer* renderer,
{
glVertexAttrib(CelestiaGLProgram::ColorAttributeIndex,
Renderer::PlanetEquatorColor);
glLineWidth(2.0f);
glLineWidth(2.0f * renderer->getScreenDpi() / 96.0f);
}
else
{
@ -166,7 +166,7 @@ PlanetographicGrid::render(Renderer* renderer,
prog->setMVPMatrices(projection, modelView * vecgl::translate(0.0f, sin(phi), 0.0f) * vecgl::scale(r));
glDrawArrays(GL_LINE_LOOP, 0, circleSubdivisions);
glLineWidth(1.0f);
glLineWidth(1.0f * renderer->getScreenDpi() / 96.0f);
if (showCoordinateLabels)
{

View File

@ -1033,7 +1033,7 @@ Renderer::enableSmoothLines()
#ifndef GL_ES
glEnable(GL_LINE_SMOOTH);
#endif
glLineWidth(1.5f);
glLineWidth(1.5f * screenDpi / 96.0f);
}
void
@ -1047,7 +1047,7 @@ Renderer::disableSmoothLines()
#ifndef GL_ES
glDisable(GL_LINE_SMOOTH);
#endif
glLineWidth(1.0f);
glLineWidth(1.0f * screenDpi / 96.0f);
}
Vector4f renderOrbitColor(const Body *body, bool selected, float opacity)
@ -5486,10 +5486,10 @@ void Renderer::drawRectangle(const Rect &r, int fishEyeOverrideMode, const Eigen
else
{
if (r.lw != 1.0f)
glLineWidth(r.lw);
glLineWidth(r.lw * screenDpi / 96.0f);
glDrawArrays(GL_LINE_LOOP, 0, 4);
if (r.lw != 1.0f)
glLineWidth(1.0f);
glLineWidth(1.0f * screenDpi / 96.0f);
}
glDisableVertexAttribArray(CelestiaGLProgram::ColorAttributeIndex);