diff --git a/panda/src/putil/loaderOptions.cxx b/panda/src/putil/loaderOptions.cxx index 1c5230e0fc..272950200d 100644 --- a/panda/src/putil/loaderOptions.cxx +++ b/panda/src/putil/loaderOptions.cxx @@ -25,10 +25,21 @@ LoaderOptions:: LoaderOptions(int flags) : _flags(flags), _texture_flags(0) { - if (preload_textures) { + // Shadowing the variables in config_util for static init ordering + // issues. + static ConfigVariableBool *preload_textures; + static ConfigVariableBool *preload_simple_textures; + if (preload_textures == NULL) { + preload_textures = new ConfigVariableBool("preload-textures", true); + } + if (preload_simple_textures == NULL) { + preload_simple_textures = new ConfigVariableBool("preload-simple-textures", false); + } + + if (*preload_textures) { _texture_flags |= TF_preload; } - if (preload_simple_textures) { + if (*preload_simple_textures) { _texture_flags |= TF_preload_simple; } }