Material does not exist.

Problems building or running the engine, queries about how to use features etc.
Post Reply
srd
Gnoblar
Posts: 21
Joined: Sun Jan 14, 2018 6:12 am

Material does not exist.

Post by srd »

I'm using 2.1 and trying to display Cube_d.mesh and after loading the following resources, but don't understand why the DebugCube material does not exist. It's in DebugPack.zip which is in the addResourceLocation(...). And it's loaded as shown below. I'm not too worried about the older format warning as that one I understand.

Code: Select all

Added resource location '/home/srd/ogre-v2-1/Samples/Media' of type 'FileSystem' to resource group 'General'                                          
Added resource location '/home/srd/ogre-v2-1/Samples/Media/packs/DebugPack.zip' of type 'Zip' to resource group 'General'                             
Mesh: Loading Cube_d.mesh.                                                     
WARNING: Cube_d.mesh is an older format ([MeshSerializer_v2.1 R1]); you should upgrade it as soon as possible using the OgreMeshTool tool.                     
Can't assign material DebugCube because this Material does not exist. Have you forgotten to define it in a .material script?
My calls look like:

Code: Select all

    Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
       "/home/srd/ogre-v2-1/Samples/Media", "FileSystem",
            Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
            
    Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
       "/home/srd/ogre-v2-1/Samples/Media/packs/DebugPack.zip", 
            "Zip",  Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
             
    Ogre::Item* item = sceneManager->createItem("Cube_d.mesh",
 Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME,
                Ogre::SCENE_DYNAMIC);
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5299
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1279
Contact:

Re: Material does not exist.

Post by dark_sylinc »

You must initialize the resources first.

i.e. you're missing the call to:

Code: Select all

Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups( true );
Which has to happen after you've added all the resource locations you want to load
Post Reply