Correctly finish rendering point stars before drawing new ones

pull/1171/head
Levin Li 2021-11-16 16:44:10 +08:00
parent b3efa631d9
commit 7c933c576d
2 changed files with 6 additions and 2 deletions

View File

@ -76,6 +76,9 @@ void PointStarVertexBuffer::makeCurrent()
if (current == this || program == nullptr)
return;
if (current != nullptr)
current->finish();
program->use();
program->setMVPMatrices(renderer.getProjectionMatrix(), renderer.getModelViewMatrix());
if (pointSizeFromVertex)
@ -101,6 +104,7 @@ void PointStarVertexBuffer::finish()
glDisableVertexAttribArray(CelestiaGLProgram::VertexCoordAttributeIndex);
if (pointSizeFromVertex)
glDisableVertexAttribArray(CelestiaGLProgram::PointSizeAttributeIndex);
current = nullptr;
}
void PointStarVertexBuffer::enable()

View File

@ -1988,7 +1988,7 @@ void Renderer::renderObjectAsPoint(const Vector3f& position,
{
float alpha = 1.0f;
float fade = 1.0f;
float size = BaseStarDiscSize * screenDpi / 96;
float size = BaseStarDiscSize * screenDpi / 96.0f;
#ifdef USE_HDR
float fieldCorr = 2.0f * FOV/(fov + FOV);
float satPoint = saturationMagNight * (1.0f + fieldCorr * fieldCorr);
@ -4652,7 +4652,7 @@ void Renderer::renderPointStars(const StarDatabase& starDB,
float effDistanceToScreen = mmToInches((float) REF_DISTANCE_TO_SCREEN) * pixelSize * getScreenDpi();
starRenderer.labelThresholdMag = 1.2f * max(1.0f, (faintestMag - 4.0f) * (1.0f - 0.5f * (float) log10(effDistanceToScreen)));
starRenderer.size = BaseStarDiscSize * screenDpi / 96;
starRenderer.size = BaseStarDiscSize * screenDpi / 96.0f;
if (starStyle == ScaledDiscStars)
{
starRenderer.useScaledDiscs = true;