The following code (code 1 and code 2) is working on Linux (CentOS 7.2, with OpenGL)
Code: Select all
//code 1
Entity *ent = mSceneMgr->createEntity("entityname", "meshname.mesh");
SceneNode *node = mSceneMgr->getRootSceneNode()->createChildSceneNode("nodename");
node->attachObject(ent);
MaterialPtr basemat = Ogre::MaterialManager::getSingletonPtr()->getByName("matname");
MaterialPtr mat = basemat->clone("matnamecopy");
ent->setMaterial(mat);
Code: Select all
//code 2
SceneNode *node = mSceneMgr->getSceneNode("nodename");
node->detachAllObjects();
mSceneMgr->destroySceneNode("nodename");
mSceneMgr->destroyEntity("entityname");
MaterialPtr mat = static_cast<MaterialPtr>(MaterialManager::getSingleton().getByName("matnamecopy"));
mat->unload();
ResourcePtr pRes = static_cast<ResourcePtr>(mat);
MaterialManager::getSingleton().remove(pRes);
But it is not working on Odroid (Ubuntu 15.04, OpenGL ES 2.x)
mesh displays correctly on the first time after I create entity, scenenode, and clone material.
When I unload SceneNode, Entity, and Material (using code 2),
and create entity, scenenode, and clone material (using code 1) again, mesh does not display.
If think there is something wrong with material.
Because if I use another material name, it is working on Odroid.
(e.g., "matnamecopy" for the 1st clone of material, and "matnamecopy2" for the 2nd clone of material,
"entityname" and "nodename" do not change for the 1st and 2nd time of creation)