Time for action — adding wireframe and point render mode

We use the code we just created, and as always, simply add the code we need for this new feature:

  1. We need a new member variable in the framelistener to save the current render mode:
    Ogre::PolygonMode _PolyMode;
    
  2. Init the value in the constructor with PM_SOLID:
    _PolyMode = Ogre::PolygonMode::PM_SOLID;
    
  3. We then add a new if condition in the frameStarted() function, which tests if the R key is pressed. If this is the case, we can change the render mode. If the current mode is solid, and we want it to be wireframe:
    if(_key->isKeyDown(OIS::KC_R))
    {
    if(_PolyMode == PM_SOLID)
    {
    _PolyMode = Ogre::PolygonMode::PM_WIREFRAME;
    }
    
  4. If it is wireframe, and we want it to change to point mode:
    else if(_PolyMode ...

Get Ogre 3D 1.7 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.