ogre-next createEntity(SceneManager::PT_SPHERE) crashes

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
User avatar
jordiperezarti
Kobold
Posts: 35
Joined: Sun Sep 01, 2024 7:50 pm

ogre-next createEntity(SceneManager::PT_SPHERE) crashes

Post by jordiperezarti »

v1::Entity *ogreEntity = sceneManager->createEntity(SceneManager::PT_SPHERE);

Crashes with no output to log, when root is initialized, window created...
loading .mesh is right, is when creating a prefab that crashes.

Any idea?

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5436
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1343

Re: ogre-next createEntity(SceneManager::PT_SPHERE) crashes

Post by dark_sylinc »

Hi!

Do you have a callstack when the crash happened?

User avatar
jordiperezarti
Kobold
Posts: 35
Joined: Sun Sep 01, 2024 7:50 pm

Re: ogre-next createEntity(SceneManager::PT_SPHERE) crashes

Post by jordiperezarti »

Code: Select all

1  Ogre::Hlms::getDefaultDatablock() const                                                                                                                                                                                                                                                                                                                0x5555556c3db4 

2  Ogre::Renderable::setMaterialName(std::string const&, std::string const&)                                                                                                                                                                                                                                                                              0x555555774462 

3  Ogre::v1::Entity::buildSubEntityList(Ogre::SharedPtr<Ogre::v1::Mesh>&, std::vector<Ogre::v1::SubEntity, Ogre::STLAllocator<Ogre::v1::SubEntity, Ogre::CategorisedAllocPolicy<(Ogre::MemoryCategory)0>>> *, std::vector<std::string, Ogre::STLAllocator<std::string, Ogre::CategorisedAllocPolicy<(Ogre::MemoryCategory)0>>> *)                         0x55555593c863 

4  Ogre::v1::Entity::_initialise(bool)                                                                                                                                                                                                                                                                                                                    0x55555593cc2f 

5  Ogre::v1::Entity::Entity(unsigned int, Ogre::ObjectMemoryManager *, Ogre::SceneManager *, Ogre::SharedPtr<Ogre::v1::Mesh> const&)                                                                                                                                                                                                                      0x55555593dba5 

6  Ogre::v1::EntityFactory::createInstanceImpl(unsigned int, Ogre::ObjectMemoryManager *, Ogre::SceneManager *, Ogre::StdMap<std::string, std::string, std::less<std::string>, Ogre::STLAllocator<std::pair<std::string const, std::string>, Ogre::CategorisedAllocPolicy<(Ogre::MemoryCategory)0>>> const *)                                             0x55555593ddc0 

7  Ogre::SceneManager::createMovableObject(std::string const&, Ogre::ObjectMemoryManager *, Ogre::StdMap<std::string, std::string, std::less<std::string>, Ogre::STLAllocator<std::pair<std::string const, std::string>, Ogre::CategorisedAllocPolicy<(Ogre::MemoryCategory)0>>> const *)                                                                 0x5555557b378b 

8  Ogre::SceneManager::createEntity(std::string const&, std::string const&, Ogre::SceneMemoryMgrTypes)                                                                                                                                                                                                                                                    0x5555557b20dc 

9  Ogre::SceneManager::createEntity(Ogre::SceneManager::PrefabType, Ogre::SceneMemoryMgrTypes)                                                                                                                                                                                                                                                            0x5555557a42e1 

10 MainApplication::setupScene                                                                                                                                                                                                                                                                                                    mainapplication.cpp 119 0x5555555fbfdb 

11 MainApplication::init                                                                                                                                                                                                                                                                                                          mainapplication.cpp 63  0x5555555fb66a 

12 main                                                                                                                                                                                                                                                                                                                           main.cpp            9   0x5555555fb00c 

The last step seems setting the default material to the sphere, but no one is defined.
How do i define the default material? (i am using the unlit shader lib)

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5436
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1343

Re: ogre-next createEntity(SceneManager::PT_SPHERE) crashes

Post by dark_sylinc »

It looks like you're calling createEntity() before HlmsPbs is setup.

If you don't use HlmsPbs, you can call HlmsManager::useDefaultDatablockFrom to use a different Hlms that's already set.

User avatar
jordiperezarti
Kobold
Posts: 35
Joined: Sun Sep 01, 2024 7:50 pm

Re: ogre-next createEntity(SceneManager::PT_SPHERE) crashes

Post by jordiperezarti »

mngHlms->useDefaultDatablockFrom(hlmsUnlit->getType());

This avoids the crash.

Thanks.