Hi, Ogre fanatics
I installed Ogre 1.9 with .deb packages on Debian. Now, I'd like to enable threads support. How can i change OGRE_CONFIG_THREADS value? How can I know the OGRE_CONFIG_THREADS value now (settings default in .deb packages)?
I don't want to install Ogre 1.9 src from sources tarball. I have installed libboost-thread-dev 1.62.0.1
Thanks in advance.
Ogre 1.9 threads support
-
- Bronze Sponsor
- Posts: 497
- Joined: Sun Jan 18, 2015 4:20 pm
- Location: Buenos Aires, Argentina
- x 179
Re: Ogre 1.9 threads support
Hello,
Check the files:
And look for the following:
The number indicates what level of threading support the library was compiled with by the Debian mantainers.
Check the files:
Code: Select all
/usr/include/OGRE/OgreBuildSettings.h
/usr/include/OGRE/OgreConfig.h
Code: Select all
#define OGRE_THREAD_SUPPORT 0
-
- Gnoblar
- Posts: 9
- Joined: Thu Apr 05, 2018 5:57 pm
- x 1
Re: Ogre 1.9 threads support
Thanks again, Sercero
In OgreBuildSettings.h -->
In OgreConfig.h -->
I think that debian mantainers built deb package with 2 but, now the current value in OgreConfig.h is 0 ¿can I change the value in OgreConfig.h for thread support for background loading, isn't it?
In OgreBuildSettings.h -->
Code: Select all
#define OGRE_THREAD_SUPPORT 2
Code: Select all
#ifndef OGRE_THREAD_SUPPORT
#define OGRE_THREAD_SUPPORT 0
#endif
#if OGRE_THREAD_SUPPORT != 0 && OGRE_THREAD_SUPPORT != 1 && OGRE_THREAD_SUPPORT != 2
#define OGRE_THREAD_SUPPORT 0
#endif
-
- Bronze Sponsor
- Posts: 497
- Joined: Sun Jan 18, 2015 4:20 pm
- Location: Buenos Aires, Argentina
- x 179
Re: Ogre 1.9 threads support
I think that you already have thread support for background loading, check the OGRE log file for something like this:
Code: Select all
23:15:37: DefaultWorkQueue('Root') initialising on thread 1.
23:15:37: Particle Renderer Type 'billboard' registered
23:15:37: DefaultWorkQueue('Root')::WorkerFunc - thread 2 starting.
23:15:37: DefaultWorkQueue('Root')::WorkerFunc - thread 3 starting.
-
- Gnoblar
- Posts: 9
- Joined: Thu Apr 05, 2018 5:57 pm
- x 1
Re: Ogre 1.9 threads support
Thanks one more time, sercero
I've loaded music with SDL (wrapper) with the next code:
There's a listener too
and looking for in Ogre.log
and showing console out
The thread support for background loading seems be running right isn't it?
I've loaded music with SDL (wrapper) with the next code:
Code: Select all
...
// Carga en segundo plano y listener
trackPtr->setBackgroundLoaded(true);
trackPtr->addListener(new MyListener);
// Escala la carga del recurso en segundo plano.
if (trackPtr->isBackgroundLoaded()) {
trackPtr->escalateLoading();
}
else {
trackPtr->load();
std::cout << "Estoy aquí!" << std::endl;
}
....
Code: Select all
#include <OGRE/OgreResource.h>
class MyListener : public Ogre::Resource::Listener {
void loadingComplete (Ogre::Resource* r) {
std::cout << "\n\t ***** ¡Carga en segundo plano completada! *****\n" << std::endl;
// TODO
}
Code: Select all
DefaultWorkQueue('Root') initialising on thread 7f7332bb9e00.
19:15:38: DefaultWorkQueue('Root')::WorkerFunc - thread 7f72f757d700 starting.
19:15:38: DefaultWorkQueue('Root')::WorkerFunc - thread 7f72f657b700 starting.
19:15:38: DefaultWorkQueue('Root')::WorkerFunc - thread 7f72f7d7e700 starting.
19:15:38: DefaultWorkQueue('Root')::WorkerFunc - thread 7f72f6d7c700 starting.
19:15:38: DefaultWorkQueue('Root')::WorkerFunc - thread 7f72f4d78700 starting.
19:15:38: DefaultWorkQueue('Root')::WorkerFunc - thread 7f72f5d7a700 starting.
19:15:38: DefaultWorkQueue('Root')::WorkerFunc - thread 7f72f5579700 starting.
19:15:38: DefaultWorkQueue('Root')::WorkerFunc - thread 7f72f1d7a700 starting.
19:15:38: DefaultWorkQueue('Root')::WorkerFunc - thread 7f72f1579700 starting.
19:15:38: DefaultWorkQueue('Root')::WorkerFunc - thread 7f72f0d78700 starting.
19:15:38: DefaultWorkQueue('Root')::WorkerFunc - thread 7f72f2d74700 starting.
19:15:38: DefaultWorkQueue('Root')::WorkerFunc - thread 7f72f3d76700 starting.
19:15:38: DefaultWorkQueue('Root')::WorkerFunc - thread 7f72f4577700 starting.
19:15:38: DefaultWorkQueue('Root')::WorkerFunc - thread 7f72f3575700 starting.
19:15:38: DefaultWorkQueue('Root')::WorkerFunc - thread 7f72f0577700 starting.
19:15:38: Particle Renderer Type 'billboard' registered
19:15:38: DefaultWorkQueue('Root')::WorkerFunc - thread 7f72efd76700 starting.
19:15:38: Added resource location 'media' of type 'FileSystem' to resource group 'General'
Code: Select all
Finished parsing scripts for resource group Internal
Creating resources for group Internal
All done
***** ¡Carga en segundo plano completada! *****
...
-
- Bronze Sponsor
- Posts: 497
- Joined: Sun Jan 18, 2015 4:20 pm
- Location: Buenos Aires, Argentina
- x 179
Re: Ogre 1.9 threads support
It seems so, I'm not an expert on this subject.