Thursday, July 19, 2012

OgreKit not support viewport orientation in Android

As I've compiled the GameKit Android demo .apk and downloaded to by Android phone, it crashed!! Debugging info shown below:

0688): OGRE EXCEPTION(9:UnimplementedException): Setting Viewport orientation mode is not supported in setOrientationMode at /Users/erikvillegas/Development/Android/gamekit-read-only/Ogre-1.8rc/OgreMain/src/OgreViewport.cpp (line 226)

Then, I open OgreViewport.cpp to take alook:

void Viewport::setOrientationMode(OrientationMode orientationMode, bool setDefault) {
#if OGRE_NO_VIEWPORT_ORIENTATIONMODE != 0
        OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED,
                    "Setting Viewport orientation mode is not supported",
                    __FUNCTION__);
#endif
        mOrientationMode = orientationMode;

        if (setDefault){
            setDefaultOrientationMode(orientationMode);
        }

        if (mCamera){
            mCamera->setOrientationMode(mOrientationMode);
        }

}

Obviously, the compile option "
OGRE_NO_VIEWPORT_ORIENTATIONMODE" is not ZERO. Then, I grep -ir "OGRE_NO_VIEWPORT_ORIENTATIONMODE" * and found that it's value should be assigned from the CMake header configure file inside "./trunk/Ogre-1.8rc/Settings/OgreBuildSettings.h.in" and

#define OGRE_NO_VIEWPORT_ORIENTATIONMODE @OGRE_SET_DISABLE_VIEWPORT_ORIENTATIONMODE@


Then, I grep all the files with defined OGRE_SET_DISABLE_VIEWPORT_ORIENTATIONMODE and set it as ZERO, especially the CMake/configOgreKit.cmake, CMake/configureBuild.cmake, and the most important, ./trunk/Ogre-1.8rc/CMakeLists.txt.


Rebuild the dev. folder by "sudo ./configure_android ../android_lib debug"
Goto ../android_lib/make


..wait for the compilation finished... and the view port orientation mode should be disabled.


Here we go!

No comments:

Post a Comment