1616#include " ../opengl/FontFormatFlags.h"
1717#include " ../opengl/OpenGL.h"
1818#include " ../opengl/OpenGLTypes.h"
19- #include < OpenGL/gl.h>
2019#include < QOpenGLFunctions>
2120#include " Connections.h"
2221#include " MapCanvasConfig.h"
@@ -578,12 +577,7 @@ void MapCanvas::actuallyPaintGL()
578577 if (m_textures.backgroundImage && m_textures.backgroundImage ->getId () != INVALID_MM_TEXTURE_ID) {
579578 const auto &tex = m_textures.backgroundImage ;
580579
581- // Manually disable depth test/write for the background image
582- glDisable (GL_DEPTH_TEST);
583- glDepthMask (GL_FALSE);
584-
585- const float z = -1000 .f ; // Far enough behind everything else
586- // Use correct coordinates: top-left → top-right → bottom-right → bottom-left
580+ // Z is arbitrary since we don't rely on depth testing here
587581 const glm::vec3 topLeft{-6 .f , 21 .f , 0 .f };
588582 const glm::vec3 topRight{721 .f , 21 .f , 0 .f };
589583 const glm::vec3 bottomRight{721 .f , -271 .f , 0 .f };
@@ -601,12 +595,8 @@ void MapCanvas::actuallyPaintGL()
601595 GLRenderState ()
602596 .withBlend (BlendModeEnum::NONE)
603597 .withTexture0 (tex->getId ())
604- .withColor (Color{1 .0f , 1 .0f , 1 .0f , 1 .0f }) // Fully opaque
598+ .withColor (Color{1 .0f , 1 .0f , 1 .0f , 1 .0f }) // Fully opaque white
605599 );
606-
607- // Restore OpenGL depth state
608- glEnable (GL_DEPTH_TEST);
609- glDepthMask (GL_TRUE);
610600 }
611601
612602 if (m_data.isEmpty ()) {
@@ -1070,7 +1060,11 @@ void MapCanvas::renderMapBatches()
10701060 const int thisLayer = layer.first ;
10711061 if (thisLayer == m_currentLayer) {
10721062 gl.clearDepth ();
1073- fadeBackground ();
1063+
1064+ // Prevent overlay dimming if we have a custom background
1065+ if (!m_textures.backgroundImage ) {
1066+ fadeBackground ();
1067+ }
10741068 }
10751069 drawLayer (thisLayer, m_currentLayer);
10761070 }
0 commit comments