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
{diffuse 1.0 1.0 1.0
{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:

A close view of box

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

Found it!

Yesterday, I was probing for 2D implementation along with 3D in Ogre. And I was in the vicinity of overlays, manual objects and so many other things. But was this required yet? No. Chase two rabbits and both will escape!
Got a better clear insight today on how to take the next steps. So I started looking for what basic primitives are facilitated by Ogre. What operations could be performed on the various primtives, that were provided by Ogre? Simultaneously, I implemented point on Qt’s scene, though was not a priority, but that segmentation fault had tested much of my patience and it was done! Also, I just worked out on adding a predefined(or static) point and line to Ogre’s scene. Was not tough though and no mouse clicks yet.
Ha! Then finally I greeted Ogre Procedural Geometry Library. This library provides basic primitives like box, sphere, torus, cylinder, cone, circle, ellipse, spline, bezier curve and yet a few more. It also supports 2D transformations namely rotation, scaling, translation and also equips operations like union, intersection, extrusion.

  • Clone it from bitbucket using- hg clone ogre-procedural To clone from bitbucket, you must install mercurial using – sudo apt-get install mercurial
  • I used cmake-gui for building it. Choose source and build directories.
  • Click on ‘Add Entry’ and set a variable ‘OGRE_HOME’ with its ‘PATH’ referring to your Ogre source directory
  • Hit ‘Configure’ and then ‘Generate’. You are done.

By this moment, I have just added a sphere using it in my scene. No material is associated with it yet. To be able to perform operations is significant. Continuing the same.

A New Turn

After yesterday’s presentation concerning the GUI, making eCAD productive to the user, considering 3D too, we landed up to the conclusion that we will be using Ogre3D and various libraries of BRL-CAD like libbn(maths), libbu(utility), librt(ray-tracing).

Oops! It happens. I was compiling OGRE from my own blog but it did not work. All the dependencies were installed on my system. What was it? Cmake could not find where the libfreetype6 library was installed. Endeavored till I was done with installation.

What did I do? I installed the dependencies in a separate folder. Ahan! bitbucket has a repository of Ogre dependencies. The zip file can be downloaded from here: ogredeps.

Then follow these steps:

  1. Extract it.
  2. cd/path_to_directory_where_you_extracted
  3. mkdir build
  4. cd build
  5. cmake ..
  6. make
  7. make install

You are done with dependencies. After this you will have a directory named ogredeps in your build directory. This has include and lib folders in it. Then I installed cmake-gui using sudo apt-get install cmake-qt-gui in order to be specific in providing paths manually.

Provide the path to your Ogre source, Ogre build directory and the dependencies directory i.e. the ogredeps you got after compiling dependencies.

Click Configure and then Generate. Phew! Worked. Now we will be implementing a cylinder in OGRE’s scene along with Qt. Till now nothing has been taken into account of 3D. But from now on, it will be done too as a priority so that no major changes have to be done in future.

So much to be done

Made changes in implementation of point. I tried to repaint applying the condition that painting shall continue until there are points stored in vector i.e. size of vector != NIL. Debugging worked but only one point on the scene. Something real silly I guess. Will try to implement this first on passing static coordinates in the vector. Well I feel all those will be painted. Still will be giving it a try tomorrow.

Then I continued with implementation of arc only. The arc has been working good if points are selected clockwise, besides with an angle difference between the start and end points more so near 180 degrees I guess.

We were told to install Librehatti. Did it. We have to understand its workflow first and foremost. Need to get hands on Django for the same.

Also tried installing OGRE. I lost it after my mint 17 fresh install. It was fun working on it for sometime. But a dependency problem led it nowhere. The same has been reported as a bug in most of the forums.

And yeah! I have been hearing of FELT these days. Well, saw it working. It’s a real powerful software. Was wondering how it would have gone under development. Awesome!

So many things to be done. I really feel the necessity of daily targets for myself. The day just flies. Real time to feel the gusto!

Compiling OGRE app in QtCreator

OGRE applications can be built in various IDEs. I went on with my friend these days- QtCreator. In order to be able to see OGRE working on my system, I made an application with pre-constructed code. You can follow the instructions below:

  1. Just download the file at this link and un-tar it. This download contains a tutorial, a dist directory and a cmake script.
  2. Put the files in a directory, say ogre-demo.
  3. Now open QtCreator and open the CMakeLists.txt file here.
  4. A dialog box will ask you to choose a build directory. By default, a new build directory is created. Just click next.
  5. Now, you will be asked to run cmake. Click the “Run Cmake” button.
  6. After this, open terminal and move to the build directory.
  7. Run make && make install there. If you do not run these, the console below in QtCreator would display an exit message.
  8. Now, you can run the app in QtCreator. You will be having a blank black screen in front of you just like the one below, though the app has compiled and is running decently.


Time to add something to see OGRE in action. 😀 I told about tutorial framework in the download done in step 1. Remember? Hm! Counting on the files in it, the entity that would be displayed in the OGRE window on running the app is defined in the file TutorialApplication.cpp. Open the file and you will find the function createScene() is empty.

Make your function look like:

void TutorialApplication::createScene(void)
// Set the scene's ambient light
mSceneMgr->setAmbientLight(Ogre::ColourValue(0.5f, 0.5f, 0.5f));

    // Create an Entity
    Ogre::Entity* ogreHead = mSceneMgr->createEntity("Head", "ogrehead.mesh");

    // Create a SceneNode and attach the Entity to it
    Ogre::SceneNode* headNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("HeadNode");

    // Create a Light and set its position
    Ogre::Light* light = mSceneMgr->createLight("MainLight");
    light->setPosition(20.0f, 80.0f, 50.0f);


Scrutinizing the code above, you will find entity Head whose source file is ogrehead.mesh. This file is present in the dist folder we got during the download, more specifically in dist/media/models folder.

Save your file and run the app. And you get this output:


Once the program is working, use the WASD keys to move, and the mouse to look around. The Escape key exits the program.

You got a basic OGRE app working with QtCreator on your system.

Well, I did not go with literal meaning of OGRE this time. 😛 You know what it is? The word "ogre" is of French origin and is used to depict a large, hideous, manlike monster that eats human beings. Ogres frequently feature in mythology, folklore, and fiction throughout the world. The above output illustrates it well! 😀

The Introductory Stride to OGRE

OGRE, acronym for Object-oriented Graphics Rendering Engine, is a scene-oriented 3D engine to make applications that make use of hardware-accelerated 3D graphics. The engine is written using C++. OGRE can be used in games, simulations.

OGRE has an object-oriented design with a plugin architecture that allows easy addition of features, thus making it highly modular. The engine is flexible, in the sense that there are no predefined constraints on those who wish to want to use OGRE, unlike other engines that are designed for a particular type of game or some application. Considering the gaming industry only, the developers can make use of different libraries in integration to OGRE, depending on their requirements.

OGRE provides support for various platforms including Linux, Windows, iOS and Android. It also imparts bracing for materials, shaders, meshes, animations. Special effects supported include compositor systems, particle systems, sprite graphics and much more. It has been used in commercial games like Torchlight and Ankh.

Installing OGRE: