[Solved] [2.1] Creating an Ogre::Item Access violation
-
- Kobold
- Posts: 29
- Joined: Tue Apr 19, 2016 2:51 pm
- x 1
[Solved] [2.1] Creating an Ogre::Item Access violation
Hi,
I will start by saying I really hope this isn't a silly problem as I still haven't worked out the problem and many days have passed. so, to begin with, I load in the wavefront obj data into an object loader, the vertices and indices data is then pushed into the index buffer and the vertex buffers, this data is then uploaded to the VAO and bound to the submesh created from the MeshPtr.
From there I run the createItem method for the scene manager passing both the MeshPtr and scenetype (which is static), a breakpoint is then triggered and an access violation error is prompted (Access violation reading location 0x0000017C.)
I have reviewed the Ogre.log which says "Can't assign material "" (blank) ", however I tried to apply a material (the legacy materials) and it prompts saying I need to update to the latest version of materials being HLMS Datablocks, however I am under the impression the only way to do so is through Ogre::Item setDataBlock which cant be used as I havent created the Ogre::Item yet.
I have followed the 2.0 DynamicGeometry sample and cannot get it to work (The sample also doesn't apply a HLMS datablock, which is why im thinking this isnt a material problem), I am running the latest iteration of the Ogre 2.1 build (commit 7c29a9a).
I would very much appreciate some help, thank-you
I will start by saying I really hope this isn't a silly problem as I still haven't worked out the problem and many days have passed. so, to begin with, I load in the wavefront obj data into an object loader, the vertices and indices data is then pushed into the index buffer and the vertex buffers, this data is then uploaded to the VAO and bound to the submesh created from the MeshPtr.
From there I run the createItem method for the scene manager passing both the MeshPtr and scenetype (which is static), a breakpoint is then triggered and an access violation error is prompted (Access violation reading location 0x0000017C.)
I have reviewed the Ogre.log which says "Can't assign material "" (blank) ", however I tried to apply a material (the legacy materials) and it prompts saying I need to update to the latest version of materials being HLMS Datablocks, however I am under the impression the only way to do so is through Ogre::Item setDataBlock which cant be used as I havent created the Ogre::Item yet.
I have followed the 2.0 DynamicGeometry sample and cannot get it to work (The sample also doesn't apply a HLMS datablock, which is why im thinking this isnt a material problem), I am running the latest iteration of the Ogre 2.1 build (commit 7c29a9a).
I would very much appreciate some help, thank-you
Last edited by TombFan1996 on Mon Aug 29, 2016 8:56 pm, edited 2 times in total.
- dark_sylinc
- OGRE Team Member
- Posts: 5299
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1279
- Contact:
Re: [2.1] Creating an Ogre::Item Access violation
Could you post a callstack when it crashes?
-
- Kobold
- Posts: 29
- Joined: Tue Apr 19, 2016 2:51 pm
- x 1
Re: [2.1] Creating an Ogre::Item Access violation
This is the call stack when the access violation occurs, one thing I've thought about is, could it be to do with using a std::vector container to store the vertices and indices and then im inputting the wrong size for the index buffer and vertex buffer?
Code: Select all
OgreMain_d.dll!0fb58361() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for OgreMain_d.dll]
OgreMain_d.dll!0fb83e43() Unknown
OgreMain_d.dll!0feb4e67() Unknown
OgreMain_d.dll!0feb50ae() Unknown
OgreMain_d.dll!0fc225e5() Unknown
OgreMain_d.dll!0fc233e1() Unknown
OgreMain_d.dll!0fc223fe() Unknown
OgreMain_d.dll!0fc239fd() Unknown
OgreMain_d.dll!0fd93bd6() Unknown
OgreMain_d.dll!0fff13d5() Unknown
OgreMain_d.dll!0ffe7d61() Unknown
OgreMain_d.dll!0ffe7e5d() Unknown
> Rarestone_Engine.exe!Rarestone::GameObject::GameObject(std::basic_string<char,std::char_traits<char>,std::allocator<char> > _go_name, Ogre::SceneMemoryMgrTypes _sceneType, Rarestone::World * _world, unsigned char _shape, unsigned short _mass) Line 42 C++
- dark_sylinc
- OGRE Team Member
- Posts: 5299
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1279
- Contact:
Re: [2.1] Creating an Ogre::Item Access violation
Hi! Unfortunately the callstack didn't help. Which is weird because it appears there were no symbols loaded; as if OgreMain_d was not compiled through debug mode (which is weird because _d stands for debug build) or the PDB was moved or destroyed. Try recompiling OgreMain_d and placing the PDB files in the same folder as the DLL.
Yes, this is definitely possible. Can you post a few snippets on how you're creating the Vaos & submeshes?TombFan1996 wrote:This is the call stack when the access violation occurs, one thing I've thought about is, could it be to do with using a std::vector container to store the vertices and indices and then im inputting the wrong size for the index buffer and vertex buffer?
-
- Kobold
- Posts: 29
- Joined: Tue Apr 19, 2016 2:51 pm
- x 1
Re: [2.1] Creating an Ogre::Item Access violation
Right, managed to recompile Ogre and import the debug symbols into my project, this is the call stack now... So it is something to do with getting a default datablock, does Ogre 2.1 have standard datablock it refers to when creating an item?, like "BaseWhiteNoLighting" for the legacy materials? and atleast for now, I know it's not an index or vertex buffer problem, I have also updated my wavefront object loader to use fixed arrays instead of std::vectors, like in your sample.
Code: Select all
OgreMain_d.dll!Ogre::Hlms::getDefaultDatablock() Line 1419 C++
> OgreMain_d.dll!Ogre::HlmsManager::getDefaultDatablock() Line 420 C++
OgreMain_d.dll!Ogre::Renderable::setMaterialName(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & name, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & groupName) Line 161 C++
OgreMain_d.dll!Ogre::Renderable::setDatablockOrMaterialName(std::basic_string<char,std::char_traits<char>,std::allocator<char> > materialName, std::basic_string<char,std::char_traits<char>,std::allocator<char> > resourceGroup) Line 83 C++
OgreMain_d.dll!Ogre::Item::buildSubItems() Line 280 C++
OgreMain_d.dll!Ogre::Item::_initialise(bool forceReinitialise) Line 112 C++
OgreMain_d.dll!Ogre::Item::Item(unsigned int id, Ogre::ObjectMemoryManager * objectMemoryManager, Ogre::SceneManager * manager, const Ogre::SharedPtr<Ogre::Mesh> & mesh) Line 71 C++
OgreMain_d.dll!Ogre::ItemFactory::createInstanceImpl(unsigned int id, Ogre::ObjectMemoryManager * objectMemoryManager, Ogre::SceneManager * manager, const std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,Ogre::STLAllocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,Ogre::CategorisedAllocPolicy<0> > > * params) Line 375 C++
OgreMain_d.dll!Ogre::MovableObjectFactory::createInstance(unsigned int id, Ogre::ObjectMemoryManager * objectMemoryManager, Ogre::SceneManager * manager, const std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,Ogre::STLAllocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,Ogre::CategorisedAllocPolicy<0> > > * params) Line 874 C++
OgreMain_d.dll!Ogre::SceneManager::createMovableObject(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & typeName, Ogre::ObjectMemoryManager * objectMemMgr, const std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,Ogre::STLAllocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,Ogre::CategorisedAllocPolicy<0> > > * params) Line 4864 C++
OgreMain_d.dll!Ogre::SceneManager::createItem(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & meshName, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & groupName, Ogre::SceneMemoryMgrTypes sceneType) Line 417 C++
OgreMain_d.dll!Ogre::SceneManager::createItem(const Ogre::SharedPtr<Ogre::Mesh> & pMesh, Ogre::SceneMemoryMgrTypes sceneType) Line 423 C++
Rarestone_Engine.exe!Rarestone::GameObject::GameObject(std::basic_string<char,std::char_traits<char>,std::allocator<char> > _go_name, Ogre::SceneMemoryMgrTypes _sceneType, Rarestone::World * _world, unsigned char _shape, unsigned short _mass) Line 42 C++
Rarestone_Engine.exe!Rarestone::Engine::start() Line 123 C++
Rarestone_Engine.exe!WinMain(HINSTANCE__ * hInst, HINSTANCE__ * __formal, char * strCmdLine, int __formal) Line 33 C++
Rarestone_Engine.exe!__tmainCRTStartup() Line 528 C
Rarestone_Engine.exe!WinMainCRTStartup() Line 377 C
kernel32.dll!75f3336a() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
ntdll.dll!777792b2() Unknown
ntdll.dll!77779285() Unknown
- dark_sylinc
- OGRE Team Member
- Posts: 5299
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1279
- Contact:
Re: [2.1] Creating an Ogre::Item Access violation
Now the error is clear.
Items (and all v2 objects) can only use Hlms materials (aka datablocks). If none was assigned, a default one will be provided.
However the crash here is happening because it seems you haven't registered any Hlms implementation. You need to register them like the samples do in GraphicsSystem::registerHlms.
Items (and all v2 objects) can only use Hlms materials (aka datablocks). If none was assigned, a default one will be provided.
However the crash here is happening because it seems you haven't registered any Hlms implementation. You need to register them like the samples do in GraphicsSystem::registerHlms.
-
- Kobold
- Posts: 29
- Joined: Tue Apr 19, 2016 2:51 pm
- x 1
Re: [2.1] Creating an Ogre::Item Access violation
Literally just found another forum post for this exact problem, working on it now, thank-you for your help