From: ThorstenB Date: Sun, 31 Jul 2011 12:00:48 +0000 (+0200) Subject: #232: resurrect the "point sprites for runway lights" switch X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b53c53d9d81cf8a8a5115e52c09086ceeb9a720f;p=simgear.git #232: resurrect the "point sprites for runway lights" switch Automatic GL/OSG feature detection still not working, since we don't have a "context" - but at least the manual switch works (on start-up only). --- diff --git a/simgear/scene/tgdb/pt_lights.cxx b/simgear/scene/tgdb/pt_lights.cxx index 5b7cf375..74c696ed 100644 --- a/simgear/scene/tgdb/pt_lights.cxx +++ b/simgear/scene/tgdb/pt_lights.cxx @@ -204,21 +204,26 @@ Effect* getLightEffect(float size, const Vec3& attenuation, Pass *combinedPass = clone(spritePass, CopyOp::SHALLOW_COPY); combinedPass->setAttributeAndModes(point); Effect* effect = new Effect; - std::vector combinedExtensions; - combinedExtensions.push_back("GL_ARB_point_sprite"); - combinedExtensions.push_back("GL_ARB_point_parameters"); - Technique* combinedTniq = new Technique; - combinedTniq->passes.push_back(combinedPass); - combinedTniq->setGLExtensionsPred(2.0, combinedExtensions); - effect->techniques.push_back(combinedTniq); - std::vector spriteExtensions; - spriteExtensions.push_back(combinedExtensions.front()); - Technique* spriteTniq = new Technique; - spriteTniq->passes.push_back(spritePass); - spriteTniq->setGLExtensionsPred(2.0, spriteExtensions); - effect->techniques.push_back(spriteTniq); std::vector parameterExtensions; - parameterExtensions.push_back(combinedExtensions.back()); + + if (SGSceneFeatures::instance()->getEnablePointSpriteLights()) + { + std::vector combinedExtensions; + combinedExtensions.push_back("GL_ARB_point_sprite"); + combinedExtensions.push_back("GL_ARB_point_parameters"); + Technique* combinedTniq = new Technique; + combinedTniq->passes.push_back(combinedPass); + combinedTniq->setGLExtensionsPred(2.0, combinedExtensions); + effect->techniques.push_back(combinedTniq); + std::vector spriteExtensions; + spriteExtensions.push_back(combinedExtensions.front()); + Technique* spriteTniq = new Technique; + spriteTniq->passes.push_back(spritePass); + spriteTniq->setGLExtensionsPred(2.0, spriteExtensions); + effect->techniques.push_back(spriteTniq); + parameterExtensions.push_back(combinedExtensions.back()); + } + Technique* parameterTniq = new Technique; parameterTniq->passes.push_back(attenuationPass); parameterTniq->setGLExtensionsPred(1.4, parameterExtensions); diff --git a/simgear/scene/util/SGSceneFeatures.hxx b/simgear/scene/util/SGSceneFeatures.hxx index 9c954015..51261286 100644 --- a/simgear/scene/util/SGSceneFeatures.hxx +++ b/simgear/scene/util/SGSceneFeatures.hxx @@ -46,6 +46,10 @@ public: void setEnablePointSpriteLights(bool enable) { _pointSpriteLights = enable; } + bool getEnablePointSpriteLights() const + { + return _pointSpriteLights; + } bool getEnablePointSpriteLights(unsigned contextId) const { if (!_pointSpriteLights)