Lucrative Sunday

I had added a sphere in my ogre scene previously. No navigation in the scene was possible. We were not able to interact with scene by any means, viz keyboard or mouse.

So implementing minimal examples following the tutorials, implemented the keyboard and mouse events in the scene. Now I can see front, bottom and one side face of the box I have added to the scene at a time. Initially, I was unable to distinguish clearly in the faces of the box since no material was assigned to it. So I looked for different materials provided in the Ogre Procedural library for now.

box->setMaterialName("Examples/Marble", ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);

The above line uses marble as the material to generate the box. In Ogre, every material file has the extension material. Following code shows marble.jpg file being set as the material of any entity whose material name == Examples/Marble. For this to work, the jpg file must exist in the textures folder created so that it is available at run time.

material Examples/Marble
{technique
{pass
{diffuse 1.0 1.0 1.0
texture_unit
{texture marble.jpg}
}}}

Before I could implement this, I got "cannot allocate an object of abstract type" error for the class which was creating the scene. This was not happening until I inherited OIS::KeyListener, OIS::MouseListener classes in my CadOgreBaseWidget class. I wondered why?

The classes inherited had pure virtual functions which were not overloaded by me. I used only 1 function initially from each of these classes. Rather all pure virtual functions of an abstract must be overloaded. Got it clear in my head for the first time.

Another element of Ogre I got clear about is Overlays. These are 2D or 3D components that are used for creating menus or other components on top of the scene. Their position remains same even if we traverse at different positions in the scene.

This is what I have done so far:

screenshot09212014_231721112
A close view of box

The next thing we will be doing is deploying mouse clicks in the Ogre scene.