User Tools

Site Tools


Lab2: Making a Scene

Today we will go a little bit deeper into the Ogre framework, and create an interactive scene, where we can navigate around, add a ground and explore the use of keyboard and Mouse input.

For this lab we will break down the application made in Lab1 into a class definition. We will look at the rendering loop and create a listener class that will handle the per-frame updates, as well as listening for user input. This lab is based on chapter 9 “The Ogre 3D Startup Sequence” from the book “Ogre 3D 1.7 - Beginner's Guide” by Felix Kerger.

At the end of this lab, we will have a similar scene as in Lab1 but we will be able to interact with the scene. This lab will include Some bonus points, and we encourage you to do them.

While the Lab Assignment is a little hard boiled, feel free and I encourage you to experiment, change the code structure (its quite ugly in the guide :) and or add functionality. Just make sure your application qualifies to the standard requirements of the Lab :)

This is somewhat our goal.


Discussion thread for this lab will be on Piazza: Lab 2 Discussion Thread. Please don't hesitate to ask questions or comment on the Lab assignment.


You need to create a new project, and configure it like we did in the first lab.You have three options:

  • Create a new project and follow the instructions in Lab 1. (Again)
  • Create a VS project template. Instuctions below
  • or Create a new project the crude way. Instuctions below.

Creating a project template →

  1. Open up your solution explorer. Important! You should already have lab 1 Working and running correctly inside your current solution directory!
  2. File→Export Template
  3. Pick lab 1 from the dropdown list of which project to base the template on. (next)
  4. Name the template and give it a description. Just something that you will be able to recognize
  5. Make sure automatically import is checked and click Finish.
  6. Now you can right click your solution folder→ Add → New project → Visual C++ → “Your Template”
  7. Give it a name and the project should inherit all the configurations from the previous project you had configured
  8. If you wish to move the source files to the new project You must copy them from the file explorer outside of Visual studio, visual studio only creates symbolic links to the source files otherwise.

Copying VS configurations the crude way →

  1. Create a new empty “win32 console application” project for this Lab.
  2. Make sure to add the project to the solution where the previous project is located.
  3. Navigate to the previous lab project folder on disk.
  4. Copy all the source and header files from previous Lab into the new Lab folder (You must copy them from the file explorer outside of Visual studio, visual studio only creates symbolic links to the source files otherwise.)
  5. Copy the file <Project name>.vcxproj from the previous project into the new one.
  6. Edit the <project name>.vcxproj with a text editor and change the following. (Make sure you save the solution and close visual studio prior to this step)
          <RootNamespace>"previous project name"</RootNamespace>
          <RootNamespace>"new project name"</RootNamespace>
  7. Then finally rename the project file to match the new project name and overwrite the vcxproj file of the new project.
  8. Now the project should build correctly and you can go on your way to start the next lab assignment. “So amaze”

Lab Project

Work through the enumerated actions in the Beginners Guide ( Don't worry, after this lab we will no longer use this guide ).

  1. “Creating a class”
  2. “Adding a FrameListener”
  3. “Adding input”
  4. “Using our own rendering loop”
  5. “Adding a frame listener - Camera”
  6. “Adding a plane and a light”

Bonus Pts

7. “Controlling the model with the arrow keys”
8. “Adding animation”
While this part is optional, you are free and encouraged to experiment on your own, make the input more pleasing, trying other animations, Sinbad can dance for an extra bonus credit :)

// Print out all available animation names for _SinbadEnt.
Ogre::AnimationStateIterator iter = _SinbadEnt->getAllAnimationStates()->getAnimationStateIterator();
while (iter.hasMoreElements()) {
       Ogre::AnimationState *a = iter.getNext();
       std::cout << a->getAnimationName() << std::endl;

When You Are Finished

You should be able to navigate the camera around Sinbad, and you should also see the plane under Sinbad receiving his shadow.

If you were a good citizen and implemented the Bonus points in the guide, you should also be able to move Sinbad with very lame controls (We will address this in a later Lab :) ), and see him animated while walking.

Upload your briefly commented (if appropriate) source files, ONLY .cpp and .h no project related thanks! into Lab2 in MySchool (zip them up if more than one). The lab projects will not be graded, but their completion counts towards your participation grade.

/var/www/ailab/WWW/wiki/data/pages/public/t-gede-16-1/lab2.txt · Last modified: 2016/01/19 17:09 by marino