Accept that it's too much work to defer light manager creation in the CS and instead use something akin to the old approach

fix-osga-rotate-wildly
AnyOldName3 10 months ago
parent dec8d32b3a
commit a761e417f1

@ -33,6 +33,11 @@ namespace SceneUtil
GLExtensionsObserver GLExtensionsObserver::sInstance{}; GLExtensionsObserver GLExtensionsObserver::sInstance{};
} }
bool glExtensionsReady()
{
return !sGLExtensions.empty();
}
osg::GLExtensions& getGLExtensions() osg::GLExtensions& getGLExtensions()
{ {
if (sGLExtensions.empty()) if (sGLExtensions.empty())

@ -6,6 +6,7 @@
namespace SceneUtil namespace SceneUtil
{ {
bool glExtensionsReady();
osg::GLExtensions& getGLExtensions(); osg::GLExtensions& getGLExtensions();
class GetGLExtensionsOperation : public osg::GraphicsOperation class GetGLExtensionsOperation : public osg::GraphicsOperation

@ -825,9 +825,9 @@ namespace SceneUtil
, mPointLightFadeEnd(0.f) , mPointLightFadeEnd(0.f)
, mPointLightFadeStart(0.f) , mPointLightFadeStart(0.f)
{ {
osg::GLExtensions& exts = SceneUtil::getGLExtensions(); osg::GLExtensions* exts = SceneUtil::glExtensionsReady() ? &SceneUtil::getGLExtensions() : nullptr;
bool supportsUBO = exts.isUniformBufferObjectSupported; bool supportsUBO = exts && exts->isUniformBufferObjectSupported;
bool supportsGPU4 = exts.isGpuShader4Supported; bool supportsGPU4 = exts && exts->isGpuShader4Supported;
mSupported[static_cast<int>(LightingMethod::FFP)] = true; mSupported[static_cast<int>(LightingMethod::FFP)] = true;
mSupported[static_cast<int>(LightingMethod::PerObjectUniform)] = true; mSupported[static_cast<int>(LightingMethod::PerObjectUniform)] = true;

Loading…
Cancel
Save