Now, we are going to create our own material using the white quad we created.
Change the material name in the application from
BaseWhiteNoLighting
toMyMaterial1:
manual->begin("MyMaterial1", RenderOperation::OT_TRIANGLE_LIST);
Create a new file named
Ogre3DBeginnersGuide.material
in themedia\materials\scripts
folder of our Ogre3D SDK.Write the following code into the material file:
material MyMaterial1 { technique { pass { texture_unit { texture leaf.png } } } }
Compile and run the application. You should see a white quad with a plant drawn onto it.
We created our first material file. In Ogre 3D, materials can be defined in material files. To be able to find our material files, we need to put them in a directory listed in the resources.cfg
, like the one we used. We also could give the path to the file directly in code using the ResourceManager
, like we did in the preceding chapter with the map we loaded.
To use our material defined...