A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
gavrus
Gnoblar
Posts: 3 Joined: Fri Sep 23, 2016 5:54 pm
Post
by gavrus » Fri Sep 23, 2016 6:16 pm
Im trying to use Ogre::ManualObject in dynamic manner:
Code: Select all
Ogre::ManualObject* mo = mSceneMgr->createManualObje("Name");
mo->setDynamic(true);
mo->begin("Material");
mo->position(...);
mo->normal(...);
mo->position(...);
mo->normal(...);
....
mo->index(...);
....
mo->end();
Ogre::SceneNode* tileNode = mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(mo);
..........
//Trying to change section
mo->beginUpdate(0);
mo->position(...);
mo->normal(...);
mo->position(...);
mo->normal(...);
....
mo->index(...);
....
mo->end(); //This line produces SEGFAULT
As you can see, line
mo->end() produces SEGFAULT, but when i try to
beginUpdate() end() whith empty body, all works fine - content of ManualObject`s section "dissapears". What im doing wrong? Why SEGFAULT occurs?
gavrus
Gnoblar
Posts: 3 Joined: Fri Sep 23, 2016 5:54 pm
Post
by gavrus » Fri Sep 23, 2016 8:53 pm
Solved)
It was must to call
beginUpdate() end() inside FrameListener callback:
Code: Select all
bool FrameListener::frameRenderingQueued(const Ogre::FrameEvent &evt)
{
manualObject->beginUpdate();
....
manualObject->end();
}