Using custom config with ApplicationContext?

Problems building or running the engine, queries about how to use features etc.
Post Reply
mrgrumpy
Gnoblar
Posts: 2
Joined: Wed Aug 14, 2019 1:56 pm

Using custom config with ApplicationContext?

Post by mrgrumpy »

I'm currently updating an old project to 1.12, and love the new simplified structure using ApplicationContext. However, my previous project was using a custom config file, replacing resources.cfg and ogre.cfg. This was implemented at runtime by creating a new root with no file paths, and setting the config options on the render system and adding resource locations to the resource group manager manually.

I'm afraid I'm a little lost on how something like this should be achieved using the ApplicationContext, and I feel like I'm missing something. I realise it's not possible to create a new root after calling:

Code: Select all

OgreBites::ApplicationContext::setup();
I've been exploring the reconfigure function, but can't find any way to prevent it from trying to use the usual .cfg files.

After spending the day on this, I thought it's time to ask for help - apologies if I'm missing something obvious.

Thanks in advance!

Ogre Version: :1.12:
Operating System: :Ubuntu:
Render System: :GL:
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: Using custom config with ApplicationContext?

Post by paroj »

To achieve what you want, you should overload

- ApplicationContextBase::createRoot
- ApplicationContextBase::oneTimeConfig
- ApplicationContextBase::locateResources

take a look at ApplicationContextBase::initApp and ApplicationContextBase::setup to see the order in which these functions are called.
mrgrumpy
Gnoblar
Posts: 2
Joined: Wed Aug 14, 2019 1:56 pm

Re: Using custom config with ApplicationContext?

Post by mrgrumpy »

Great, thanks! This looks like exactly what I was needing.

Thanks a bunch!
Post Reply