diff options
author | Georg Zotti <georg.zotti@univie.ac.at> | 2016-02-03 00:57:08 +0100 |
---|---|---|
committer | Georg Zotti <georg.zotti@univie.ac.at> | 2016-02-03 00:57:08 +0100 |
commit | 9ede40663c021c01ad1a263660fb5f18c77acf6a (patch) | |
tree | 8bcfd59f407b3a63abf4c1fcceff29532fc03aab | |
parent | e8966ec19799ffd7408e1f689233ebc060a12347 (diff) |
Stelpainter: restore OpenGL state after drawText(). Fixed all relevant calls in other classes. Result should be fine now. Massive savings in OpenGL state switching!gz_reduceOpenGLstateChanges
-rw-r--r-- | plugins/ArchaeoLines/src/ArchaeoLines.cpp | 17 | ||||
-rw-r--r-- | plugins/Exoplanets/src/Exoplanet.cpp | 4 | ||||
-rw-r--r-- | plugins/Exoplanets/src/Exoplanets.cpp | 4 | ||||
-rw-r--r-- | plugins/MeteorShowers/src/MeteorShower.cpp | 4 | ||||
-rw-r--r-- | plugins/MeteorShowers/src/MeteorShowers.cpp | 2 | ||||
-rw-r--r-- | plugins/NavStars/src/NavStars.cpp | 6 | ||||
-rw-r--r-- | plugins/Novae/src/Novae.cpp | 2 | ||||
-rw-r--r-- | plugins/Pulsars/src/Pulsars.cpp | 2 | ||||
-rw-r--r-- | plugins/Quasars/src/Quasars.cpp | 2 | ||||
-rw-r--r-- | plugins/Supernovae/src/Supernovae.cpp | 2 | ||||
-rw-r--r-- | src/core/StelPainter.cpp | 41 | ||||
-rw-r--r-- | src/core/StelPainter.hpp | 2 | ||||
-rw-r--r-- | src/core/StelSkyDrawer.cpp | 8 | ||||
-rw-r--r-- | src/core/modules/ConstellationMgr.cpp | 6 | ||||
-rw-r--r-- | src/core/modules/GridLinesMgr.cpp | 2 | ||||
-rw-r--r-- | src/core/modules/Nebula.cpp | 2 | ||||
-rw-r--r-- | src/core/modules/Planet.cpp | 6 |
17 files changed, 52 insertions, 60 deletions
diff --git a/plugins/ArchaeoLines/src/ArchaeoLines.cpp b/plugins/ArchaeoLines/src/ArchaeoLines.cpp index 9e37ac4f21..c5702e22f8 100644 --- a/plugins/ArchaeoLines/src/ArchaeoLines.cpp +++ b/plugins/ArchaeoLines/src/ArchaeoLines.cpp @@ -731,7 +731,7 @@ void alViewportEdgeIntersectCallback(const Vec3d& screenPos, const Vec3d& direct d->sPainter->drawText(screenPos[0], screenPos[1], text, angleDeg, xshift, 3); //d->sPainter->setColor(tmpColor[0], tmpColor[1], tmpColor[2], tmpColor[3]); // RESTORE d->sPainter->enableTexture2d(false, false, __FILE__, __LINE__); - d->sPainter->enableBlend(true, true, __FILE__, __LINE__); + d->sPainter->enableBlend(true, false, __FILE__, __LINE__); d->sPainter->setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } @@ -858,16 +858,8 @@ void ArchaeoLine::draw(StelCore *core, float intensity) const sPainter.drawSmallCircleArc(pt1, pt2, rotCenter, alViewportEdgeIntersectCallback, &userData); sPainter.drawSmallCircleArc(pt2, pt3, rotCenter, alViewportEdgeIntersectCallback, &userData); sPainter.drawSmallCircleArc(pt3, pt1, rotCenter, alViewportEdgeIntersectCallback, &userData); - //sPainter.enableLineSmooth(false); - //sPainter.enableBlend(false); - return; - } - else - { - //sPainter.enableLineSmooth(false); - //sPainter.enableBlend(false); - return; } + return; } // Draw the arc in 2 sub-arcs to avoid lengths > 180 deg Vec3d middlePoint = p1-rotCenter+p2-rotCenter; @@ -880,11 +872,6 @@ void ArchaeoLine::draw(StelCore *core, float intensity) const middlePoint*=-1.; middlePoint+=rotCenter; } - sPainter.drawSmallCircleArc(p1, middlePoint, rotCenter,alViewportEdgeIntersectCallback, &userData); sPainter.drawSmallCircleArc(p2, middlePoint, rotCenter, alViewportEdgeIntersectCallback, &userData); - - // GZ Remove needless state changes - //sPainter.enableLineSmooth(false); - //sPainter.enableBlend(false); } diff --git a/plugins/Exoplanets/src/Exoplanet.cpp b/plugins/Exoplanets/src/Exoplanet.cpp index 0a5105f66c..90f346b058 100644 --- a/plugins/Exoplanets/src/Exoplanet.cpp +++ b/plugins/Exoplanets/src/Exoplanet.cpp @@ -492,8 +492,8 @@ void Exoplanet::draw(StelCore* core, StelPainter *painter) if (labelsFader.getInterstate()<=0.f && !distributionMode && (mag+1.f)<mlimit && smgr->getFlagLabels()) { painter->drawText(XYZ, getNameI18n(), 0, shift, shift, false); - // drawText garbles blend. - painter->enableBlend(true, true, __FILE__, __LINE__); + // drawText garbled blend. + //painter->enableBlend(true, true, __FILE__, __LINE__); } } } diff --git a/plugins/Exoplanets/src/Exoplanets.cpp b/plugins/Exoplanets/src/Exoplanets.cpp index c65a2b74c3..09d431ec1c 100644 --- a/plugins/Exoplanets/src/Exoplanets.cpp +++ b/plugins/Exoplanets/src/Exoplanets.cpp @@ -230,8 +230,6 @@ void Exoplanets::draw(StelCore* core) if (eps && eps->initialized) { eps->draw(core, &painter); - // drawText ruined blend. restore. - //painter.enableBlend(true, true, __FILE__, __LINE__); } } @@ -256,7 +254,7 @@ void Exoplanets::drawPointer(StelCore* core, StelPainter& painter) const Vec3f& c(obj->getInfoColor()); painter.setColor(c[0],c[1],c[2]); texPointer->bind(); - painter.enableTexture2d(true); + painter.enableTexture2d(true, false, __FILE__, __LINE__); painter.enableBlend(true, false, __FILE__, __LINE__); painter.setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode painter.drawSprite2dMode(screenpos[0], screenpos[1], 13.f, StelApp::getInstance().getTotalRunTime()*40.); diff --git a/plugins/MeteorShowers/src/MeteorShower.cpp b/plugins/MeteorShowers/src/MeteorShower.cpp index b514ff16a8..b630f8c2f7 100644 --- a/plugins/MeteorShowers/src/MeteorShower.cpp +++ b/plugins/MeteorShowers/src/MeteorShower.cpp @@ -366,8 +366,8 @@ void MeteorShower::drawRadiant(StelCore *core) if ((mag+1.f)<mlimit) { painter.drawText(XY[0]+shift, XY[1]+shift, getNameI18n(), 0, 0, 0, false); - // drawText garbles blend state. restore, forced :-( - painter.enableBlend(true, true, __FILE__, __LINE__); + // drawText garbled blend state. restore, forced :-( + //painter.enableBlend(true, true, __FILE__, __LINE__); } } diff --git a/plugins/MeteorShowers/src/MeteorShowers.cpp b/plugins/MeteorShowers/src/MeteorShowers.cpp index bdaae63d18..2455ca66f8 100644 --- a/plugins/MeteorShowers/src/MeteorShowers.cpp +++ b/plugins/MeteorShowers/src/MeteorShowers.cpp @@ -81,7 +81,7 @@ void MeteorShowers::drawPointer(StelCore* core) const Vec3f& c(obj->getInfoColor()); painter.setColor(c[0],c[1],c[2]); m_mgr->getPointerTexture()->bind(); - painter.enableTexture2d(true); + painter.enableTexture2d(true, false, __FILE__, __LINE__); painter.enableBlend(true, false, __FILE__, __LINE__); painter.setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode diff --git a/plugins/NavStars/src/NavStars.cpp b/plugins/NavStars/src/NavStars.cpp index cad23ec509..061855415f 100644 --- a/plugins/NavStars/src/NavStars.cpp +++ b/plugins/NavStars/src/NavStars.cpp @@ -185,7 +185,7 @@ void NavStars::draw(StelCore* core) if (!markerTexture.isNull()) { painter.enableBlend(true, false, __FILE__, __LINE__); - painter.enableTexture2d(true); + painter.enableTexture2d(true, false, __FILE__, __LINE__); painter.setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); painter.setColor(markerColor[0], markerColor[1], @@ -200,8 +200,8 @@ void NavStars::draw(StelCore* core) if (i > 0) // Not Polaris label = QString("%1 (%2)").arg(label).arg(i); painter.drawText(pos[0], pos[1], label, 0, 10.f, 10.f, false); - // drawText garbles blend mode... force back. - painter.enableBlend(true, true, __FILE__, __LINE__); + // drawText garbled blend mode... force back. + //painter.enableBlend(true, true, __FILE__, __LINE__); } } diff --git a/plugins/Novae/src/Novae.cpp b/plugins/Novae/src/Novae.cpp index 587e113a33..77b8e5ebd9 100644 --- a/plugins/Novae/src/Novae.cpp +++ b/plugins/Novae/src/Novae.cpp @@ -224,7 +224,7 @@ void Novae::drawPointer(StelCore* core, StelPainter &painter) const Vec3f& c(obj->getInfoColor()); painter.setColor(c[0],c[1],c[2]); texPointer->bind(); - painter.enableTexture2d(true); + painter.enableTexture2d(true, false, __FILE__, __LINE__); painter.enableBlend(true, false, __FILE__, __LINE__); painter.setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode painter.drawSprite2dMode(screenpos[0], screenpos[1], 13.f, StelApp::getInstance().getTotalRunTime()*40.); diff --git a/plugins/Pulsars/src/Pulsars.cpp b/plugins/Pulsars/src/Pulsars.cpp index bfbf1ebb71..150b53ccfa 100644 --- a/plugins/Pulsars/src/Pulsars.cpp +++ b/plugins/Pulsars/src/Pulsars.cpp @@ -259,7 +259,7 @@ void Pulsars::drawPointer(StelCore* core, StelPainter& painter) const Vec3f& c(obj->getInfoColor()); painter.setColor(c[0],c[1],c[2]); texPointer->bind(); - painter.enableTexture2d(true); + painter.enableTexture2d(true, false, __FILE__, __LINE__); painter.enableBlend(true, false, __FILE__, __LINE__); painter.setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode painter.drawSprite2dMode(screenpos[0], screenpos[1], 13.f, StelApp::getInstance().getTotalRunTime()*40.); diff --git a/plugins/Quasars/src/Quasars.cpp b/plugins/Quasars/src/Quasars.cpp index 04ad10c431..4c88f67170 100644 --- a/plugins/Quasars/src/Quasars.cpp +++ b/plugins/Quasars/src/Quasars.cpp @@ -261,7 +261,7 @@ void Quasars::drawPointer(StelCore* core, StelPainter& painter) const Vec3f& c(obj->getInfoColor()); painter.setColor(c[0],c[1],c[2]); texPointer->bind(); - painter.enableTexture2d(true); + painter.enableTexture2d(true, false, __FILE__, __LINE__); painter.enableBlend(true, false, __FILE__, __LINE__); painter.setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode painter.drawSprite2dMode(screenpos[0], screenpos[1], 13.f, StelApp::getInstance().getTotalRunTime()*40.); diff --git a/plugins/Supernovae/src/Supernovae.cpp b/plugins/Supernovae/src/Supernovae.cpp index 48f164e67f..0b6d7d82f2 100644 --- a/plugins/Supernovae/src/Supernovae.cpp +++ b/plugins/Supernovae/src/Supernovae.cpp @@ -227,7 +227,7 @@ void Supernovae::drawPointer(StelCore* core, StelPainter& painter) const Vec3f& c(obj->getInfoColor()); painter.setColor(c[0],c[1],c[2]); texPointer->bind(); - painter.enableTexture2d(true); + painter.enableTexture2d(true, false, __FILE__, __LINE__); painter.enableBlend(true, false, __FILE__, __LINE__); painter.setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode painter.drawSprite2dMode(screenpos[0], screenpos[1], 13.f, StelApp::getInstance().getTotalRunTime()*40.); diff --git a/src/core/StelPainter.cpp b/src/core/StelPainter.cpp index a2e5ff984b..42769f5295 100644 --- a/src/core/StelPainter.cpp +++ b/src/core/StelPainter.cpp @@ -71,7 +71,6 @@ int StelPainter::blendMode[4]; // srcRGB, dstRGB, srcAlpha, dstAlpha or src, dst // This is unused. While elegant in concept, glGet... is slow, so avoid that except for debugging. //StelPainter::GLState::GLState() //{ - // blend = glIsEnabled(GL_BLEND); // glGetIntegerv(GL_BLEND_SRC_RGB, &blendSrcRGB); // glGetIntegerv(GL_BLEND_DST_RGB, &blendDstRGB); @@ -350,8 +349,6 @@ void StelPainter::computeFanDisk(float radius, int innerFanSlices, int level, QV vertexArr << x << y << 0; } } - - } static void sSphereMapTexCoordFast(float rho_div_fov, const float costheta, const float sintheta, QVector<float>& out) @@ -592,11 +589,20 @@ void StelPainter::drawText(float x, float y, const QString& str, float angleDeg, // Often blend state will be garbled and must be restored after calling drawText(). // Given that this function may come in a loop, its better to call it after that loop. // Or, trying to force restoration of blend, linesmooth, etc. This causes 5 state changes. - //restoreCachedOpenGLstate(); + // restoreCachedOpenGLstate(); // Still not enough. Better not call this here, but hand-track that stuff. // We must do that here. TODO: Do whatever is necessary to fix drawText... - enableBlend(blendingEnabled, true); + //enableBlend(blendingEnabled, true); + } + // QPainter scope is finished. + // It seems we only must restore 3 states: + enableTexture2d(texture2dEnabled, true, __FILE__, __LINE__); + //enableFaceCulling(faceCullingEnabled, false, __FILE__, __LINE__); + //enableDepthTest(depthTestEnabled, false, __FILE__, __LINE__); + //enableLineSmooth(lineSmoothEnabled, false, __FILE__, __LINE__); + enableBlend(blendingEnabled, true, __FILE__, __LINE__); + setBlendFunc(blendMode[0], blendMode[1], blendMode[2], blendMode[3], separateBlendingEnabled, true); } // Recursive method cutting a small circle in small segments @@ -1439,7 +1445,7 @@ void StelPainter::drawSphericalRegion(const SphericalRegion* poly, SphericalPoly case SphericalPolygonDrawModeFill: case SphericalPolygonDrawModeTextureFill: case SphericalPolygonDrawModeTextureFillColormodulated: - glEnable(GL_CULL_FACE); + enableFaceCulling(true, false, __FILE__, __LINE__); // The polygon is already tesselated as triangles if (doSubDivise || prj->intersectViewportDiscontinuity(poly->getBoundingCap())) // flag for color-modulated textured mode (e.g. for Milky Way/extincted) @@ -1447,7 +1453,7 @@ void StelPainter::drawSphericalRegion(const SphericalRegion* poly, SphericalPoly else drawStelVertexArray(poly->getFillVertexArray(), false); - glDisable(GL_CULL_FACE); + //enableFaceCulling(false, false, __FILE__, __LINE__); // REQUIRED? break; default: Q_ASSERT(0); @@ -1954,12 +1960,12 @@ void StelPainter::enableBlend(const bool b, const bool force, QString filename, #endif } -void StelPainter::setBlendFunc(const int src, const int dst, const int srcAlpha, const int dstAlpha, const bool separate) +void StelPainter::setBlendFunc(const int src, const int dst, const int srcAlpha, const int dstAlpha, const bool separate, const bool force) { // If any previous state did not match, set state. Else avoid it! if (separate) { - if ( !separateBlendingEnabled || (src!=blendMode[0]) || (dst!=blendMode[1]) || (srcAlpha!=blendMode[2]) || (dstAlpha!=blendMode[3]) ) + if ( !separateBlendingEnabled || force || (src!=blendMode[0]) || (dst!=blendMode[1]) || (srcAlpha!=blendMode[2]) || (dstAlpha!=blendMode[3]) ) { separateBlendingEnabled=true; glBlendFuncSeparate(src, dst, srcAlpha, dstAlpha); @@ -1978,7 +1984,7 @@ void StelPainter::setBlendFunc(const int src, const int dst, const int srcAlpha, } else { - if ( separateBlendingEnabled || (src!=blendMode[0]) || (dst!=blendMode[1]) ) + if ( separateBlendingEnabled || force || (src!=blendMode[0]) || (dst!=blendMode[1]) ) { separateBlendingEnabled=false; glBlendFunc(src, dst); @@ -1995,13 +2001,16 @@ void StelPainter::setBlendFunc(const int src, const int dst, const int srcAlpha, } } +// AVOID USING THIS! Better just take the lines as shown here, wharn you need them. void StelPainter::restoreCachedOpenGLstate() { - enableTexture2d(texture2dEnabled, true); - enableFaceCulling(faceCullingEnabled, true); - enableDepthTest(depthTestEnabled, true); - enableLineSmooth(lineSmoothEnabled, true); - enableBlend(blendingEnabled, true); + // It is a bit unclear which states are broken by drawText's QPainter. Only set 2nd argument to true if there are log messages. + enableTexture2d(texture2dEnabled, true, __FILE__, __LINE__); // req. by QPainter action. + enableFaceCulling(faceCullingEnabled, true, __FILE__, __LINE__); + enableDepthTest(depthTestEnabled, true, __FILE__, __LINE__); + enableLineSmooth(lineSmoothEnabled, true, __FILE__, __LINE__); + enableBlend(blendingEnabled, true, __FILE__, __LINE__); // req. by QPainter action. + setBlendFunc(blendMode[0], blendMode[1], blendMode[2], blendMode[3], separateBlendingEnabled, true); // req. by QPainter action. } void StelPainter::initGLShaders() @@ -2329,7 +2338,7 @@ StelPainter::ArrayDesc StelPainter::projectArray(const StelPainter::ArrayDesc& a #ifndef NDEBUG void StelPainter::stateChangeDiagnosticsLog() { - qDebug() << "StelPainter has cached a few OpenGL state changes:" ; + qDebug() << "StelPainter has cached a few OpenGL state change types:" ; qDebug() << " Switches of GL_TEXTURE_2D: " << stateChangeCounters.texture2dEnabled.first << "Avoided:" << stateChangeCounters.texture2dEnabled.second; qDebug() << " Switches of GL_CULL_FACE: " << stateChangeCounters.faceCullingEnabled.first << "Avoided:" << stateChangeCounters.faceCullingEnabled.second; qDebug() << " Switches of GL_DEPTH_TEST: " << stateChangeCounters.depthTestEnabled.first << "Avoided:" << stateChangeCounters.depthTestEnabled.second; diff --git a/src/core/StelPainter.hpp b/src/core/StelPainter.hpp index e5cd875b2d..ba680e533b 100644 --- a/src/core/StelPainter.hpp +++ b/src/core/StelPainter.hpp @@ -290,7 +290,7 @@ public: //! but only if required. //! Using this consistently avoids needless OpenGL state changes. //! There is no need currently for a get operator here. - static void setBlendFunc(const int src, const int dst, const int srcAlpha=0, const int dstAlpha=0, const bool separate=false); + static void setBlendFunc(const int src, const int dst, const int srcAlpha=0, const int dstAlpha=0, const bool separate=false, const bool force=false); //! Some draw commands misbehave. StelPainter::drawText uses a QPainter which modifies the OpenGL state in an unclear way //! which breaks the assumptions that we can cache the state in all cases. diff --git a/src/core/StelSkyDrawer.cpp b/src/core/StelSkyDrawer.cpp index f533e9a96b..80dd9ba736 100644 --- a/src/core/StelSkyDrawer.cpp +++ b/src/core/StelSkyDrawer.cpp @@ -375,7 +375,7 @@ void StelSkyDrawer::preDrawPointSource(StelPainter* p) // bright star will cause tiny black squares on the bright star, e.g. see Procyon. // For some reason, at this point blend state may be confused. Force blending on. // TODO: Explain why we must force texturing here. - p->enableBlend(true, true, __FILE__, __LINE__); + p->enableBlend(true, false, __FILE__, __LINE__); p->setBlendFunc(GL_ONE, GL_ONE); p->enableTexture2d(true, true, __FILE__, __LINE__); } @@ -389,7 +389,7 @@ void StelSkyDrawer::postDrawPointSource(StelPainter* sPainter) return; texHalo->bind(); // GZ We did all that in preDrawPointSource. Why do we NEED it here again, and even forced? - sPainter->enableBlend(true, true, __FILE__, __LINE__); + sPainter->enableBlend(true, false, __FILE__, __LINE__); sPainter->setBlendFunc(GL_ONE, GL_ONE); sPainter->enableTexture2d(true, false, __FILE__, __LINE__); @@ -442,10 +442,10 @@ bool StelSkyDrawer::drawPointSource(StelPainter* sPainter, const Vec3f& v, const cmag = 1.f; texBigHalo->bind(); - // GZ We did all that in preDrawPointSource. WHY IS IT REQUIRED AGAIN??? + // GZ We did all that in preDrawPointSource. WHY IS IT REQUIRED AGAIN??? HAA, no more, StelPainter::drawText was guilty for all troubles. sPainter->enableTexture2d(true, false, __FILE__, __LINE__); sPainter->setBlendFunc(GL_ONE, GL_ONE); - sPainter->enableBlend(true, true, __FILE__, __LINE__); + sPainter->enableBlend(true, false, __FILE__, __LINE__); sPainter->setColor(color[0]*cmag, color[1]*cmag, color[2]*cmag); // TODO According to AMD GL profiler, it would radically increase performance to also buffer this sprite drawing! 64% of draws may be here! sPainter->drawSprite2dModeNoDeviceScale(win[0], win[1], rmag); diff --git a/src/core/modules/ConstellationMgr.cpp b/src/core/modules/ConstellationMgr.cpp index b68f06ada5..8da920f5e6 100644 --- a/src/core/modules/ConstellationMgr.cpp +++ b/src/core/modules/ConstellationMgr.cpp @@ -582,8 +582,8 @@ void ConstellationMgr::drawArt(StelPainter& sPainter) const { sPainter.setBlendFunc(GL_ONE, GL_ONE); // TODO: Find out why texture and blending state may be confused at this point. We must override and set in any case. - sPainter.enableTexture2d(true, true, __FILE__, __LINE__); // - sPainter.enableBlend(true, true, __FILE__, __LINE__); + sPainter.enableTexture2d(true, false, __FILE__, __LINE__); // + sPainter.enableBlend(true, false, __FILE__, __LINE__); sPainter.enableFaceCulling(true, false, __FILE__, __LINE__); vector < Constellation * >::const_iterator iter; @@ -592,8 +592,6 @@ void ConstellationMgr::drawArt(StelPainter& sPainter) const { (*iter)->drawArtOptim(sPainter, *region); } - - //glDisable(GL_CULL_FACE); // GZ Not meaningful. Next module will set what it needs. } // Draw constellations lines diff --git a/src/core/modules/GridLinesMgr.cpp b/src/core/modules/GridLinesMgr.cpp index eca22b38da..c415638875 100644 --- a/src/core/modules/GridLinesMgr.cpp +++ b/src/core/modules/GridLinesMgr.cpp @@ -308,7 +308,7 @@ void viewportEdgeIntersectCallback(const Vec3d& screenPos, const Vec3d& directio d->sPainter->drawText(screenPos[0], screenPos[1], text, angleDeg, xshift, 3); d->sPainter->setColor(tmpColor[0], tmpColor[1], tmpColor[2], tmpColor[3]); d->sPainter->enableTexture2d(false, false, __FILE__, __LINE__); - d->sPainter->enableBlend(true, true, __FILE__, __LINE__); + d->sPainter->enableBlend(true, false, __FILE__, __LINE__); d->sPainter->setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } diff --git a/src/core/modules/Nebula.cpp b/src/core/modules/Nebula.cpp index db1f8e7b08..c7237743f5 100644 --- a/src/core/modules/Nebula.cpp +++ b/src/core/modules/Nebula.cpp @@ -449,7 +449,7 @@ void Nebula::drawHints(StelPainter& sPainter, float maxMagHints) // GZ This state should have been switched on already. // For some reason, we must override and re-activate blending here. // TODO: Find out why this is required! - sPainter.enableBlend(true, true, __FILE__, __LINE__); + sPainter.enableBlend(true, false, __FILE__, __LINE__); sPainter.setBlendFunc(GL_ONE, GL_ONE); float lum = 1.f;//qMin(1,4.f/getOnScreenSize(core))*0.8; diff --git a/src/core/modules/Planet.cpp b/src/core/modules/Planet.cpp index 8765d12669..3f9a4be814 100644 --- a/src/core/modules/Planet.cpp +++ b/src/core/modules/Planet.cpp @@ -1702,10 +1702,10 @@ void Planet::drawSphere(StelPainter* painter, float screenSz, bool drawOnlyRing) return; } } - painter->enableTexture2d(true, true, __FILE__, __LINE__); // WE MUST SET THIS FORCEFULLY + painter->enableTexture2d(true, false, __FILE__, __LINE__); // WE MUST SET THIS FORCEFULLY // TODO: It is unclear why blending state is confused at this point. We must set here explicitly. - painter->enableBlend(false, true, __FILE__, __LINE__); - painter->enableFaceCulling(true); + painter->enableBlend(false, false, __FILE__, __LINE__); + painter->enableFaceCulling(true, false, __FILE__, __LINE__); // Draw the spheroid itself // Adapt the number of facets according with the size of the sphere for optimization |