• Ogre 1.9 Android移植

    2013-02-25 15:29:43
    上一篇博客,将1.8.1这个版本移植到了Android平台,无奈着不是官方版本,不太完美。这次尝试为Android平台构建1.9版本(注意这是个不稳定版本,1.9官方没有正式Release)。 依赖库官方已经移植好了,直接下载下来就...

    源地址:http://blog.csdn.net/shangguanwaner/article/details/8569568

    上一篇博客,将1.8.1这个版本移植到了Android平台,无奈着不是官方版本,不太完美。这次尝试为Android平台构建1.9版本(注意这是个不稳定版本,1.9官方没有正式Release)。

    依赖库官方已经移植好了,直接下载下来就可以了。

    地址 http://sourceforge.net/projects/ogre/files/ogre-dependencies-android/1.9/AndroidDependencies.zip/download

    具体的移植步骤,请看这里的官方文档,很详细了。我就说几个移植中需要注意的地方。

    Android NDK我选的是官方的android-ndk-r8d,顺利的移植了,其他版本无一幸免都有无法检测编译机器类型的错误,应该是Ogre使用的android-cmake版本的问题,具体我没有细究。

    环境变量ANDROID_NDK别忘了,这个是android-cmake脚本要用到的。

    编译出来的,SampleOgreBrowserNDK这个安装包的resources.cfg有点小问题,我做了点修改,修改如下:

    # Resources required by the sample browser and most samples.
    [Essential]
    APKZip=/packs/SdkTrays.zip
    APKFileSystem=/thumbnails

    # Common sample resources needed by many of the samples.
    # Rarely used resources should be separately loaded by the
    # samples which require them.
    [Popular]
    APKFileSystem=/fonts
    APKFileSystem=/materials/programs
    APKFileSystem=/materials/programs/GLSLES
    APKFileSystem=/materials/scripts
    APKFileSystem=/materials/textures
    APKFileSystem=/materials/textures/nvidia
    APKFileSystem=/models
    APKFileSystem=/particle
    APKFileSystem=/RTShaderLib
    APKFileSystem=/RTShaderLib/materials
    APKFileSystem=/RTShaderLib/GLSLES
    APKFileSystem=/materials/scripts/SSAO
    APKFileSystem=/materials/textures/SSAO
    APKZip=/packs/cubemap.zip
    APKZip=/packs/cubemapsJS.zip
    APKZip=/packs/dragon.zip
    APKZip=/packs/fresneldemo.zip
    APKZip=/packs/ogretestmap.zip
    APKZip=/packs/ogredance.zip
    APKZip=/packs/Sinbad.zip
    APKZip=/packs/skybox.zip

    [General]
    APKFileSystem=/

     

    编译出来的库都是静态链接的,一堆依赖,稍不留神就出问题,可能本人水平不够吧。

    写了个测试程序,SampleBrowser这个项目一堆#ifdef,看着真心头疼,自己写了个简单的Android测试程序。

    先上代码:

    //File: main.cpp

    #include <OgrePlatform.h>
    #include <OgreRoot.h>
    #include <EGL/egl.h>
    #include <GLES/gl.h>

    #include <android/log.h>
    #include <android_native_app_glue.h>

    #ifdef OGRE_STATIC_LIB
    #include <OgreStaticPluginLoader.h>
    #endif

    #ifdef USE_RTSHADER_SYSTEM
    #   include "OgreRTShaderSystem.h"
    #endif

    #include "Android/OgreAPKFileSystemArchive.h"
    #include "Android/OgreAPKZipArchive.h"
    #include "ANDROID/OgreAndroidEGLWindow.h"

    #define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "Ogre", __VA_ARGS__))
    #define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "Ogre", __VA_ARGS__))

    #ifdef OGRE_STATIC_LIB
    Ogre::StaticPluginLoader* gStaticPluginLoader;
    #endif

    Ogre::Root* gRoot = NULL;
    Ogre::RenderWindow* gWnd = NULL;
    AAssetManager* gAssetMgr = NULL;
    bool bInit = false;

    static Ogre::DataStreamPtr openAPKFile(const Ogre::String& fileName)
    {
        Ogre::DataStreamPtr stream;
        AAsset* asset = AAssetManager_open(gAssetMgr, fileName.c_str(), AASSET_MODE_BUFFER);
        if(asset) {
            off_t length = AAsset_getLength(asset);
            void* membuf = OGRE_MALLOC(length, Ogre::MEMCATEGORY_GENERAL);
            memcpy(membuf, AAsset_getBuffer(asset), length);
            AAsset_close(asset);

            stream = Ogre::DataStreamPtr(new Ogre::MemoryDataStream(membuf, length, true, true));
        }

        return stream;
    }

    static void handleCmd(struct android_app* app, int32_t cmd)
    {
        switch(cmd)
        {
        case APP_CMD_INIT_WINDOW:
            if(app->window && gRoot) {
                AConfiguration* config = AConfiguration_new();
                AConfiguration_fromAssetManager(config, app->activity->assetManager);

                if(!gWnd) {
                    LOGW("APP_CMD_INIT_WINDOW");
                    Ogre::NameValuePairList opt;
                    opt["externalWindowHandle"] = Ogre::StringConverter::toString((int)app->window);
                    opt["androidConfig"] = Ogre::StringConverter::toString((int)config);
                    gWnd = Ogre::Root::getSingleton().createRenderWindow("OgreWindow", 0, 0, false, &opt);

                    if(gWnd->isFullScreen()) {
                        LOGW("Window Is Fullscreen");
                    }

                    Ogre::Root::getSingleton().getRenderSystem()->_initRenderTargets();

                                // Clear event times
                                Ogre::Root::getSingleton().clearEventTimes();

                    LOGI("CreateSceneManager Begin");
                    Ogre::SceneManager* sm = gRoot->createSceneManager(Ogre::ST_GENERIC, "DummyScene");
                    LOGI("CreateSceneManager End");

                    Ogre::Camera* cam = sm->createCamera("DummyCamera");
                    cam->setPosition(Ogre::Vector3(20, 80, 50));
                    cam->lookAt(Ogre::Vector3(0, 0, 0));
                    cam->setNearClipDistance(5);

                    Ogre::Viewport* vp = gWnd->addViewport(cam);
                    vp->setBackgroundColour(Ogre::ColourValue(0.9, 0.9, 0.9));

                    Ogre::Real fWidth = vp->getActualWidth();
                    Ogre::Real fHeight = vp->getActualHeight();
                    LOGW("fWidth: %f, fHeight: %f", fWidth, fHeight);

                    cam->setAspectRatio(Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight()));

                    Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);

                    sm->setAmbientLight(Ogre::ColourValue(0.9, 0.9, 0.9));
                    sm->createLight()->setPosition(20, 80, 50);

                    sm->setSkyBox(true, "Examples/CloudyNoonSkyBox");
                    Ogre::Entity* head = sm->createEntity("Head", "ogrehead.mesh");
                    Ogre::Entity* head2 = sm->createEntity("Head2", "r5capsule.mesh");

                    Ogre::SceneNode* headNode = sm->getRootSceneNode()->createChildSceneNode();
                    headNode->attachObject(head);
                    headNode->setPosition(0, 0, 0);

                    Ogre::SceneNode* headNode2 = sm->getRootSceneNode()->createChildSceneNode();
                    headNode2->attachObject(head2);
                    headNode2->setPosition(0, 10, 0);

                    gWnd->windowMovedOrResized();
                    bInit = true;
                }else
                {
                    static_cast<Ogre::AndroidEGLWindow*>(gWnd)->_createInternalResources(app->window, config);
                }

                AConfiguration_delete(config);
            }
            break;
        }
    }

    void android_main(struct android_app* state)
    {
        app_dummy();

        gAssetMgr = state->activity->assetManager;

        struct android_pool_source* source;

        state->onAppCmd = &handleCmd;
        gRoot = new Ogre::Root();

    //#ifdef OGRE_STATIC_LIB
        LOGI("Load Plugin");
        gStaticPluginLoader = new Ogre::StaticPluginLoader();
        gStaticPluginLoader->load();
        LOGI("Load Plugin End");
    //#endif
        Ogre::ArchiveManager::getSingleton().addArchiveFactory(new Ogre::APKFileSystemArchiveFactory(gAssetMgr));
        Ogre::ArchiveManager::getSingleton().addArchiveFactory(new Ogre::APKZipArchiveFactory(gAssetMgr));

        gRoot->setRenderSystem(gRoot->getAvailableRenderers().at(0));
        gRoot->initialise(false);

        Ogre::ConfigFile cf;
        cf.load(openAPKFile("resources.cfg"));

        Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
        Ogre::String sec, type, arch;

        while(seci.hasMoreElements()) {
            sec = seci.peekNextKey();
            Ogre::ConfigFile::SettingsMultiMap* settings = seci.getNext();
            Ogre::ConfigFile::SettingsMultiMap::iterator i;

            for(i = settings->begin(); i != settings->end(); i++) {
                type = i->first;
                arch = i->second;

                LOGI("arch: %s, type: %s, sec: %s", arch.c_str(), type.c_str(), sec.c_str());
                Ogre::ResourceGroupManager::getSingleton().addResourceLocation(arch, type, sec);
            }
        }

        Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();

        while (1) {

                int ident;
                int events;
                struct android_poll_source* source;

                while ((ident=ALooper_pollAll(0, NULL, &events,
                        (void**)&source)) >= 0) {

                    // Process this event.
                    if (source != NULL)
                        source->process(state, source);

                    if(state->destroyRequested != 0)
                        return;

                 }

                 if(gWnd != NULL && gWnd->isActive()) {
                    gWnd->windowMovedOrResized();
                    gRoot->renderOneFrame();
                 }
        }
    }

     

    使用了NativeActivity,所以不用写一行Java代码。(NativeActivity Android NKD中有个例子,代码不明白的话可以参考一下)。接着是Android.mk

     

    LOCAL_PATH := $(call my-dir)
    include $(CLEAR_VARS)

    LOCAL_MODULE := andogre

    LOCAL_SRC_FILES := main.cpp

    LOCAL_LDLIBS := -landroid -lc -lm -ldl -llog -lEGL -lGLESv2
    LOCAL_LDLIBS += -L$(MY_HOME)/android/ogre-v1-9/lib -L$(MY_HOME)/android/AndroidDependencies/lib/armeabi
    LOCAL_LDLIBS += -lPlugin_ParticleFXStatic -lPlugin_OctreeSceneManagerStatic -lRenderSystem_GLES2Static
    LOCAL_LDLIBS += -lOgreRTShaderSystemStatic -lOgreOverlayStatic -lOgreMainStatic
    LOCAL_LDLIBS += -lzzip -lz -lFreeImage -lfreetype -lOIS $(MY_HOME)/android/systemlibs/armeabi/libsupc++.a $(MY_HOME)/android/systemlibs/armeabi/libstdc++.a D:/workspace/AndOgre/obj/local/armeabi/libcpufeatures.a

    LOCAL_STATIC_LIBRARIES := android_native_app_glue cpufeatures

    LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES=1 -I$(MY_HOME)/android/ogre-v1-9/include/OGRE
    LOCAL_CFLAGS += -I$(MY_HOME)/android/ogre-v1-9/include/OGRE/Android
    LOCAL_CFLAGS += -I$(MY_HOME)/android/ogre-v1-9/include/OGRE/Overlay
    LOCAL_CFLAGS += -I$(MY_HOME)/android/ogre-v1-9/include/OGRE/Plugins/OctreeSceneManager
    LOCAL_CFLAGS += -I$(MY_HOME)/android/ogre-v1-9/include/OGRE/Plugins/ParticleFX
    LOCAL_CFLAGS += -I$(MY_HOME)/android/ogre-v1-9/include/OGRE/RenderSystems/GLES2
    LOCAL_CFLAGS += -I$(MY_HOME)/android/ogre-v1-9/include/OGRE/RTShaderSystem
    LOCAL_CFLAGS += -ID:/android-ndk-r8d/sources/cpufeatures
    LOCAL_CFLAGS += -I$(MY_HOME)/android/AndroidDependencies/include
    LOCAL_CFLAGS += -I$(MY_HOME)/android/AndroidDependencies/include/OIS
    LOCAL_CFLAGS += -fexceptions -frtti -x c++ -D___ANDROID___ -DANDROID -DZZIP_OMIT_CONFIG_H -DUSE_RTSHADER_SYSTEM=1
    LOCAL_CFLAGS += -DOGRE_STATIC_GLES2 -DOGRE_STATIC_OctreeSceneManager -DOGRE_STATIC_ParticleFX

    include $(BUILD_SHARED_LIBRARY)

    $(call import-module, android/native_app_glue)
    $(call import-module, android/cpufeatures)

     

    Application.mk文件:

    APP_ABI := armeabi
    APP_STL := gnustl_static

    为了使用NativeActivity,AndroidManifest.xml得改一下,要不然系统不能识别到NativityActivity

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="cloud.example.andogre"
        android:versionCode="1"
        android:versionName="1.0" >

        <uses-sdk
            android:minSdkVersion="8"
            android:targetSdkVersion="17" />

          <-- 无java代码 -->

          <application android:allowBackup="true" android:label="@string/app_name" android:hasCode="false">

            <-- 这里,告诉系统Activity是NativeActivity -->
            <activity android:name="android.app.NativeActivity"
                    android:label="@string/app_name"
                    android:configChanges="orientation|keyboardHidden"
                    android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" >
                <!-- Tell NativeActivity the name of or .so -->
                <meta-data android:name="android.app.lib_name"
                        android:value="andogre" />
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>

    </manifest>

     

    以上就是全部内容。欢迎指正

    展开全文
  • Ogre3D 1.8.1 Android移植

    2012-12-21 00:40:31
    1.准备工作 系统环境:Linux Ubuntu12.04 LTS 32bit NDK:因为官方NDK对C++异常支持不够完整,所以这里使用的是非官方版本的NDK,下载地址...Ogre3D 1.8.1 https://sourceforge.net/projects/ogre/files/ogre

    1.准备工作

    系统环境:Linux Ubuntu12.04 LTS 32bit

    NDK:因为官方NDK对C++异常支持不够完整,所以这里使用的是非官方版本的NDK,下载地址http://www.crystax.net/en/android/ndk/7

    下载源代码:

    Ogre3D 1.8.1 https://sourceforge.net/projects/ogre/files/ogre/1.8/1.8.1/ogre_src_v1-8-1.tar.bz2/download

    还需要下载一些依赖的库,http://bitbucket.org/cabalistic/ogredeps,后面我们要先做这些依赖库的移植。

    2.建立工作目录

    建立一个叫ogre-port的工作目录,准备好了之后,结构如下:

    Dependencies

    --jni

    OGRE

    --jni

    我们分两步来移植,第一步移植依赖库,都放在Dependencies/jni下面,第二步才能正确移植Ogre,Ogre的源代码都放在OGRE/jni下面。

    解开下载来的ogredeps,我们需要的只有三个库,分别是FreeImage,freetype和zziplib,其他的都不需要。将这三个库拷贝到Dependencies/jni下面。

    将Ogre的源代码解压,拷贝到OGRE/jni下面,准备工作就算结束了,下面可以开始具体的移植工作。

    3.移植依赖库

    在Dependencies/jni下创建两个文件Android.mk,Application.mk:

    Android.mk

    LOCAL_PATH := $(call my-dir)
    
    include $(CLEAR_VARS)
     
    LOCAL_MODULE    := libzzip
    LOCAL_LDLIBS    := -ldl -lz
    LOCAL_SRC_FILES := zzip/dir.c zzip/err.c zzip/fetch.c zzip/file.c zzip/fseeko.c zzip/info.c zzip/memdisk.c zzip/mmapped.c zzip/plugin.c zzip/stat.c zzip/write.c zzip/zip.c
     
    include $(BUILD_STATIC_LIBRARY)
    
    include $(CLEAR_VARS)
    
    LOCAL_MODULE        := libfreeimage 
    LOCAL_LDLIBS        := -ldl -lz
    LOCAL_C_INCLUDES    := $(LOCAL_PATH)/freeimage $(LOCAL_PATH)/freeimage/Metadata $(LOCAL_PATH)/freeimage/DeprecationManager
    LOCAL_CFLAGS        += -DFREEIMAGE_LIB=1 -DPNG_STATIC=1
    LOCAL_SRC_FILES        :=\
        freeimage/DeprecationManager/Deprecated.cpp\
        freeimage/DeprecationManager/DeprecationMgr.cpp\
        freeimage/FreeImage/BitmapAccess.cpp\
        freeimage/FreeImage/CacheFile.cpp\
        freeimage/FreeImage/ColorLookup.cpp\
        freeimage/FreeImage/Conversion.cpp\
        freeimage/FreeImage/ConversionFloat.cpp\
        freeimage/FreeImage/Conversion4.cpp\
        freeimage/FreeImage/Conversion8.cpp\
        freeimage/FreeImage/Conversion16_555.cpp\
        freeimage/FreeImage/Conversion16_565.cpp\
        freeimage/FreeImage/Conversion24.cpp\
        freeimage/FreeImage/Conversion32.cpp\
        freeimage/FreeImage/ConversionRGB16.cpp\
        freeimage/FreeImage/ConversionRGBF.cpp\
        freeimage/FreeImage/ConversionUINT16.cpp\
        freeimage/FreeImage/ConversionType.cpp\
        freeimage/FreeImage/FreeImage.cpp\
        freeimage/FreeImage/FreeImageIO.cpp\
        freeimage/FreeImage/GetType.cpp\
        freeimage/FreeImage/Halftoning.cpp\
        freeimage/FreeImage/J2KHelper.cpp\
        freeimage/FreeImage/MemoryIO.cpp\
        freeimage/FreeImage/MultiPage.cpp\
        freeimage/FreeImage/NNQuantizer.cpp\
        freeimage/FreeImage/PixelAccess.cpp\
        freeimage/FreeImage/Plugin.cpp\
        freeimage/FreeImage/PluginGIF.cpp\
        freeimage/FreeImage/PluginJPEG.cpp\
        freeimage/FreeImage/PluginPNG.cpp\
        freeimage/FreeImage/ToneMapping.cpp\
        freeimage/FreeImage/tmoColorConvert.cpp\
        freeimage/FreeImage/tmoDrago03.cpp\
        freeimage/FreeImage/tmoFattal02.cpp\
        freeimage/FreeImage/tmoReinhard05.cpp\
        freeimage/FreeImage/WuQuantizer.cpp\
        freeimage/FreeImage/ZLibInterface.cpp\
        freeimage/FreeImageToolkit/Background.cpp\
        freeimage/FreeImageToolkit/Colors.cpp\
        freeimage/FreeImageToolkit/Flip.cpp\
        freeimage/FreeImageToolkit/Resize.cpp\
        freeimage/FreeImageToolkit/BSplineRotate.cpp\
        freeimage/FreeImageToolkit/CopyPaste.cpp\
        freeimage/FreeImageToolkit/JPEGTransform.cpp\
        freeimage/FreeImageToolkit/Channels.cpp\
        freeimage/FreeImageToolkit/Display.cpp\
        freeimage/FreeImageToolkit/MultigridPoissonSolver.cpp\
        freeimage/FreeImageToolkit/ClassicRotate.cpp\
        freeimage/FreeImageToolkit/Rescale.cpp\
        freeimage/LibJPEG/ckconfig.c\
        freeimage/LibJPEG/jaricom.c\
        freeimage/LibJPEG/jcapimin.c\
        freeimage/LibJPEG/jcapistd.c\
        freeimage/LibJPEG/jcarith.c\
        freeimage/LibJPEG/jccoefct.c\
        freeimage/LibJPEG/jccolor.c\
        freeimage/LibJPEG/jcdctmgr.c\
        freeimage/LibJPEG/jchuff.c\
        freeimage/LibJPEG/jcinit.c\
        freeimage/LibJPEG/jcmainct.c\
        freeimage/LibJPEG/jcmarker.c\
        freeimage/LibJPEG/jcmaster.c\
        freeimage/LibJPEG/jcomapi.c\
        freeimage/LibJPEG/jconfig.txt\
        freeimage/LibJPEG/jcparam.c\
        freeimage/LibJPEG/jcprepct.c\
        freeimage/LibJPEG/jcsample.c\
        freeimage/LibJPEG/jctrans.c\
        freeimage/LibJPEG/jdapimin.c\
        freeimage/LibJPEG/jdapistd.c\
        freeimage/LibJPEG/jdarith.c\
        freeimage/LibJPEG/jdatadst.c\
        freeimage/LibJPEG/jdatasrc.c\
        freeimage/LibJPEG/jdcoefct.c\
        freeimage/LibJPEG/jdcolor.c\
        freeimage/LibJPEG/jddctmgr.c\
        freeimage/LibJPEG/jdhuff.c\
        freeimage/LibJPEG/jdinput.c\
        freeimage/LibJPEG/jdmainct.c\
        freeimage/LibJPEG/jdmarker.c\
        freeimage/LibJPEG/jdmaster.c\
        freeimage/LibJPEG/jdmerge.c\
        freeimage/LibJPEG/jdpostct.c\
        freeimage/LibJPEG/jdsample.c\
        freeimage/LibJPEG/jdtrans.c\
        freeimage/LibJPEG/jerror.c\
        freeimage/LibJPEG/jfdctflt.c\
        freeimage/LibJPEG/jfdctfst.c\
        freeimage/LibJPEG/jfdctint.c\
        freeimage/LibJPEG/jidctflt.c\
        freeimage/LibJPEG/jidctfst.c\
        freeimage/LibJPEG/jidctint.c\
        freeimage/LibJPEG/jmemmgr.c\
        freeimage/LibJPEG/jmemnobs.c\
        freeimage/LibJPEG/jquant1.c\
        freeimage/LibJPEG/jquant2.c\
        freeimage/LibJPEG/jutils.c\
        freeimage/LibJPEG/rdbmp.c\
        freeimage/LibJPEG/rdcolmap.c\
        freeimage/LibJPEG/rdgif.c\
        freeimage/LibJPEG/rdppm.c\
        freeimage/LibJPEG/rdrle.c\
        freeimage/LibJPEG/rdswitch.c\
        freeimage/LibJPEG/rdtarga.c\
        freeimage/LibJPEG/transupp.c\
        freeimage/LibJPEG/wrbmp.c\
        freeimage/LibJPEG/wrgif.c\
        freeimage/LibJPEG/wrppm.c\
        freeimage/LibJPEG/wrrle.c\
        freeimage/LibJPEG/wrtarga.c\
        freeimage/LibPNG/png.c\
        freeimage/LibPNG/pngerror.c\
        freeimage/LibPNG/pnggccrd.c\
        freeimage/LibPNG/pngget.c\
        freeimage/LibPNG/pngmem.c\
        freeimage/LibPNG/pngpread.c\
        freeimage/LibPNG/pngread.c\
        freeimage/LibPNG/pngrio.c\
        freeimage/LibPNG/pngrtran.c\
        freeimage/LibPNG/pngrutil.c\
        freeimage/LibPNG/pngset.c\
        freeimage/LibPNG/pngtrans.c\
        freeimage/LibPNG/pngvcrd.c\
        freeimage/LibPNG/pngwio.c\
        freeimage/LibPNG/pngwrite.c\
        freeimage/LibPNG/pngwtran.c\
        freeimage/LibPNG/pngwutil.c\
        freeimage/Metadata/Exif.cpp\
        freeimage/Metadata/FIRational.cpp\
        freeimage/Metadata/FreeImageTag.cpp\
        freeimage/Metadata/IPTC.cpp\
        freeimage/Metadata/TagConversion.cpp\
        freeimage/Metadata/TagLib.cpp\
        freeimage/LibOpenJPEG/bio.c\
        freeimage/LibOpenJPEG/cidx_manager.c\
        freeimage/LibOpenJPEG/cio.c\
        freeimage/LibOpenJPEG/dwt.c\
        freeimage/LibOpenJPEG/event.c\
        freeimage/LibOpenJPEG/image.c\
        freeimage/LibOpenJPEG/j2k.c\
        freeimage/LibOpenJPEG/j2k_lib.c\
        freeimage/LibOpenJPEG/jp2.c\
        freeimage/LibOpenJPEG/jpt.c\
        freeimage/LibOpenJPEG/mct.c\
        freeimage/LibOpenJPEG/mct.h\
        freeimage/LibOpenJPEG/mqc.c\
        freeimage/LibOpenJPEG/mqc.h\
        freeimage/LibOpenJPEG/openjpeg.c\
        freeimage/LibOpenJPEG/phix_manager.c\
        freeimage/LibOpenJPEG/pi.c\
        freeimage/LibOpenJPEG/ppix_manager.c\
        freeimage/LibOpenJPEG/raw.c\
        freeimage/LibOpenJPEG/t1.c\
        freeimage/LibOpenJPEG/t2.c\
        freeimage/LibOpenJPEG/tcd.c\
        freeimage/LibOpenJPEG/tgt.c\
        freeimage/LibOpenJPEG/thix_manager.c\
        freeimage/LibOpenJPEG/tpix_manager.c\
    
    include $(BUILD_STATIC_LIBRARY)
    
    include $(CLEAR_VARS)
    LOCAL_MODULE    := libfreetype
    LOCAL_C_INCLUDES    := $(LOCAL_PATH)/freetype/include $(LOCAL_PATH)/freetype/builds/unix
    LOCAL_CFLAGS   := -DFT2_BUILD_LIBRARY
    LOCAL_SRC_FILES     :=\
            freetype/src/autofit/autofit.c\
            freetype/src/base/ftbase.c\
            freetype/src/base/ftbbox.c\
            freetype/src/base/ftbitmap.c\
            freetype/src/base/ftfstype.c\
            freetype/src/base/ftgasp.c\
            freetype/src/base/ftglyph.c\
            freetype/src/base/ftinit.c\
            freetype/src/base/ftmm.c\
            freetype/src/base/ftpfr.c\
            freetype/src/base/ftstroke.c\
            freetype/src/base/ftsynth.c\
            freetype/src/base/ftsystem.c\
            freetype/src/base/fttype1.c\
            freetype/src/base/ftwinfnt.c\
            freetype/src/bdf/bdf.c\
            freetype/src/bzip2/ftbzip2.c\
            freetype/src/cache/ftcache.c\
            freetype/src/cff/cff.c\
            freetype/src/cid/type1cid.c\
            freetype/src/gzip/ftgzip.c\
            freetype/src/lzw/ftlzw.c\
            freetype/src/pcf/pcf.c\
            freetype/src/pfr/pfr.c\
            freetype/src/psaux/psaux.c\
            freetype/src/pshinter/pshinter.c\
            freetype/src/psnames/psmodule.c\
            freetype/src/raster/raster.c\
            freetype/src/sfnt/sfnt.c\
            freetype/src/smooth/smooth.c\
            freetype/src/truetype/truetype.c\
            freetype/src/type1/type1.c\
            freetype/src/type42/type42.c\
            freetype/src/winfonts/winfnt.c
     
     include $(BUILD_STATIC_LIBRARY)
    
    

    Application.mk

    APP_OPTIM := release
    APP_PLATFORM := android-8
    APP_PLATFORM := gnustl_static
    APP_CPPFLAGS += -frtti
    APP_CPPFLAGS += -fexceptions
    APP_CPPFLAGS += -DANDROID
    
    APP_MODULES := freeimage freetype zzip
    
    

    这里,依赖库都编译成静态库。

    先别编译,代码还有些小的调整,

    找到Dependencies / jni / zzip / _config.h这个文件,将27行注释掉,

    #ifndef ZZIP_HAVE_DIRENT_H

    // #define ZZIP_HAVE_DIRENT_H 1

    #endif

    不注释掉,后面会报错,说找不到telldir的引用。

    找到Dependencies/jni/freeimage/FreeImage/Plugin.cpp这个文件,把无法移植的组件都注释掉,从224行开始

    if (s_plugins) {
                /* NOTE : 
                The order used to initialize internal plugins below MUST BE the same order 
                as the one used to define the FREE_IMAGE_FORMAT enum. 
                */
                //s_plugins->AddNode(InitBMP);
                //s_plugins->AddNode(InitICO);
                s_plugins->AddNode(InitJPEG);
                //s_plugins->AddNode(InitJNG);
                //s_plugins->AddNode(InitKOALA);
                //s_plugins->AddNode(InitIFF);
                //s_plugins->AddNode(InitMNG);
                //s_plugins->AddNode(InitPNM, NULL, "PBM", "Portable Bitmap (ASCII)", "pbm", "^P1");
                //s_plugins->AddNode(InitPNM, NULL, "PBMRAW", "Portable Bitmap (RAW)", "pbm", "^P4");
                //s_plugins->AddNode(InitPCD);
                //s_plugins->AddNode(InitPCX);
                //s_plugins->AddNode(InitPNM, NULL, "PGM", "Portable Greymap (ASCII)", "pgm", "^P2");
                //s_plugins->AddNode(InitPNM, NULL, "PGMRAW", "Portable Greymap (RAW)", "pgm", "^P5");
                s_plugins->AddNode(InitPNG);
                //s_plugins->AddNode(InitPNM, NULL, "PPM", "Portable Pixelmap (ASCII)", "ppm", "^P3");
                //s_plugins->AddNode(InitPNM, NULL, "PPMRAW", "Portable Pixelmap (RAW)", "ppm", "^P6");
                //s_plugins->AddNode(InitRAS);
                //s_plugins->AddNode(InitTARGA);
                //s_plugins->AddNode(InitTIFF);
                //s_plugins->AddNode(InitWBMP);
                //s_plugins->AddNode(InitPSD);
                //s_plugins->AddNode(InitCUT);
                //s_plugins->AddNode(InitXBM);
                //s_plugins->AddNode(InitXPM);
                //s_plugins->AddNode(InitDDS);
                s_plugins->AddNode(InitGIF);
                //s_plugins->AddNode(InitHDR);
                //s_plugins->AddNode(InitG3);
                //s_plugins->AddNode(InitSGI);
                //s_plugins->AddNode(InitEXR);
                //s_plugins->AddNode(InitJ2K);
                //s_plugins->AddNode(InitJP2);
                //s_plugins->AddNode(InitPFM);
                //s_plugins->AddNode(InitPICT);
                //s_plugins->AddNode(InitRAW);
                
                // external plugin initialization
    
    

    进入Dependencies目录,执行ndk-build -j4,编译比较慢,加上参数-j4可以加快编译速度,4代表你的机器的核心数。

    编译完成后,把生成的静态库放到OGRE/lib目录下,链接生成ogre动态库的时候会用到。

    4.移植Ogre

    在OGRE/jni下面创建文件OgreBuildSettings.h,Android下某些组件不能工作,需要靠这个文件来将其禁用掉,否则编译没办法继续,内容如下:

    #ifndef _Custom_Config_H_

    #define _Custom_Config_H_

    #define OGRE_MEMORY_ALLOCATOR OGRE_MEMORY_ALLOCATOR_STD

    #define OGRE_NO_GLES3_CG_SUPPORT 1

    #define OGRE_NO_GLES2_CG_SUPPORT 1

    #define OGRE_NO_GLES2_GLSL_OPTIMISER 1

    #endif

    然后准备Make文件:

    Android.mk

    LOCAL_PATH := $(call my-dir)
    
    include $(CLEAR_VARS)
     
    LOCAL_MODULE        := libogre
    LOCAL_C_INCLUDES    := $(LOCAL_PATH)/ogre $(LOCAL_PATH)/ogre/OgreMain/include $(LOCAL_PATH)/ogre/dependencies $(LOCAL_PATH)/ogre/dependencies/freeimage $(LOCAL_PATH)/ogre/Components/RTShaderSystem/include $(LOCAL_PATH)/ogre/RenderSystems/GLES2/include $(LOCAL_PATH)/ogre/RenderSystems/GLES2/include $(LOCAL_PATH)/ogre/RenderSystems/GLES2/src/GLSLES/include $(LOCAL_PATH)/ogre/RenderSystems/GLES2/include/Android $(LOCAL_PATH)/ogre/PlugIns/ParticleFX/include $(LOCAL_PATH)/../../Dependencies/jni/freetype/include $(LOCAL_PATH)/../../Dependencies/jni/freeimage $(LOCAL_PATH)/../../Dependencies/jni
    LOCAL_CFLAGS        := -DFREEIMAGE_LIB=1 -DOGRE_NONCLIENT_BUILD=1
    LOCAL_LDLIBS        := -L$(LOCAL_PATH)/../lib -lfreeimage -lzzip -ldl -llog -lz -lGLESv2 -lfreetype
    LOCAL_SRC_FILES        := ogre/OgreMain/src/OgreAlignedAllocator.cpp\
        ogre/OgreMain/src/OgreAnimable.cpp\
        ogre/OgreMain/src/OgreAnimation.cpp\
        ogre/OgreMain/src/OgreAnimationState.cpp\
        ogre/OgreMain/src/OgreAnimationTrack.cpp\
        ogre/OgreMain/src/OgreArchiveManager.cpp\
        ogre/OgreMain/src/OgreAutoParamDataSource.cpp\
        ogre/OgreMain/src/OgreAxisAlignedBox.cpp\
        ogre/OgreMain/src/OgreBillboard.cpp\
        ogre/OgreMain/src/OgreBillboardChain.cpp\
        ogre/OgreMain/src/OgreBillboardParticleRenderer.cpp\
        ogre/OgreMain/src/OgreBillboardSet.cpp\
        ogre/OgreMain/src/OgreBone.cpp\
        ogre/OgreMain/src/OgreBorderPanelOverlayElement.cpp\
        ogre/OgreMain/src/OgreCamera.cpp\
        ogre/OgreMain/src/OgreCodec.cpp\
        ogre/OgreMain/src/OgreColourValue.cpp\
        ogre/OgreMain/src/OgreCommon.cpp\
        ogre/OgreMain/src/OgreCompositionPass.cpp\
        ogre/OgreMain/src/OgreCompositionTargetPass.cpp\
        ogre/OgreMain/src/OgreCompositionTechnique.cpp\
        ogre/OgreMain/src/OgreCompositor.cpp\
        ogre/OgreMain/src/OgreCompositorChain.cpp\
        ogre/OgreMain/src/OgreCompositorInstance.cpp\
        ogre/OgreMain/src/OgreCompositorManager.cpp\
        ogre/OgreMain/src/OgreConfigFile.cpp\
        ogre/OgreMain/src/OgreControllerManager.cpp\
        ogre/OgreMain/src/OgreConvexBody.cpp\
        ogre/OgreMain/src/OgreDataStream.cpp\
        ogre/OgreMain/src/OgreDDSCodec.cpp\
        ogre/OgreMain/src/OgreDefaultHardwareBufferManager.cpp\
        ogre/OgreMain/src/OgreDefaultSceneQueries.cpp\
        ogre/OgreMain/src/OgreDeflate.cpp\
        ogre/OgreMain/src/OgreDepthBuffer.cpp\
        ogre/OgreMain/src/OgreDistanceLodStrategy.cpp\
        ogre/OgreMain/src/OgreDualQuaternion.cpp\
        ogre/OgreMain/src/OgreDynLib.cpp\
        ogre/OgreMain/src/OgreDynLibManager.cpp\
        ogre/OgreMain/src/OgreEdgeListBuilder.cpp\
        ogre/OgreMain/src/OgreEntity.cpp\
        ogre/OgreMain/src/OgreException.cpp\
        ogre/OgreMain/src/OgreExternalTextureSource.cpp\
        ogre/OgreMain/src/OgreExternalTextureSourceManager.cpp\
        ogre/OgreMain/src/OgreFileSystem.cpp\
        ogre/OgreMain/src/OgreFont.cpp\
        ogre/OgreMain/src/OgreFontManager.cpp\
        ogre/OgreMain/src/OgreFreeImageCodec.cpp\
        ogre/OgreMain/src/OgreFrustum.cpp\
        ogre/OgreMain/src/OgreGpuProgram.cpp\
        ogre/OgreMain/src/OgreGpuProgramManager.cpp\
        ogre/OgreMain/src/OgreGpuProgramParams.cpp\
        ogre/OgreMain/src/OgreGpuProgramUsage.cpp\
        ogre/OgreMain/src/OgreHardwareBufferManager.cpp\
        ogre/OgreMain/src/OgreHardwareIndexBuffer.cpp\
        ogre/OgreMain/src/OgreHardwareOcclusionQuery.cpp\
        ogre/OgreMain/src/OgreHardwarePixelBuffer.cpp\
        ogre/OgreMain/src/OgreHardwareVertexBuffer.cpp\
        ogre/OgreMain/src/OgreHighLevelGpuProgram.cpp\
        ogre/OgreMain/src/OgreHighLevelGpuProgramManager.cpp\
        ogre/OgreMain/src/OgreImage.cpp\
        ogre/OgreMain/src/OgreInstanceBatch.cpp\
        ogre/OgreMain/src/OgreInstanceBatchHW.cpp\
        ogre/OgreMain/src/OgreInstanceBatchHW_VTF.cpp\
        ogre/OgreMain/src/OgreInstanceBatchShader.cpp\
        ogre/OgreMain/src/OgreInstanceBatchVTF.cpp\
        ogre/OgreMain/src/OgreInstancedEntity.cpp\
        ogre/OgreMain/src/OgreInstancedGeometry.cpp\
        ogre/OgreMain/src/OgreInstanceManager.cpp\
        ogre/OgreMain/src/OgreKeyFrame.cpp\
        ogre/OgreMain/src/OgreLight.cpp\
        ogre/OgreMain/src/OgreLodStrategy.cpp\
        ogre/OgreMain/src/OgreLodStrategyManager.cpp\
        ogre/OgreMain/src/OgreLog.cpp\
        ogre/OgreMain/src/OgreLogManager.cpp\
        ogre/OgreMain/src/OgreManualObject.cpp\
        ogre/OgreMain/src/OgreMaterial.cpp\
        ogre/OgreMain/src/OgreMaterialManager.cpp\
        ogre/OgreMain/src/OgreMaterialSerializer.cpp\
        ogre/OgreMain/src/OgreMath.cpp\
        ogre/OgreMain/src/OgreMatrix3.cpp\
        ogre/OgreMain/src/OgreMatrix4.cpp\
        ogre/OgreMain/src/OgreMemoryAllocatedObject.cpp\
        ogre/OgreMain/src/OgreMemoryNedAlloc.cpp\
        ogre/OgreMain/src/OgreMemoryNedPooling.cpp\
        ogre/OgreMain/src/OgreMemoryTracker.cpp\
        ogre/OgreMain/src/OgreMesh.cpp\
        ogre/OgreMain/src/OgreMeshManager.cpp\
        ogre/OgreMain/src/OgreMeshSerializer.cpp\
        ogre/OgreMain/src/OgreMeshSerializerImpl.cpp\
        ogre/OgreMain/src/OgreMovableObject.cpp\
        ogre/OgreMain/src/OgreMovablePlane.cpp\
        ogre/OgreMain/src/OgreNode.cpp\
        ogre/OgreMain/src/OgreNumerics.cpp\
        ogre/OgreMain/src/OgreOptimisedUtil.cpp\
        ogre/OgreMain/src/OgreOptimisedUtilGeneral.cpp\
        ogre/OgreMain/src/OgreOptimisedUtilSSE.cpp\
        ogre/OgreMain/src/OgreOverlay.cpp\
        ogre/OgreMain/src/OgreOverlayContainer.cpp\
        ogre/OgreMain/src/OgreOverlayElement.cpp\
        ogre/OgreMain/src/OgreOverlayElementCommands.cpp\
        ogre/OgreMain/src/OgreOverlayElementFactory.cpp\
        ogre/OgreMain/src/OgreOverlayManager.cpp\
        ogre/OgreMain/src/OgrePanelOverlayElement.cpp\
        ogre/OgreMain/src/OgreParticle.cpp\
        ogre/OgreMain/src/OgreParticleEmitter.cpp\
        ogre/OgreMain/src/OgreParticleEmitterCommands.cpp\
        ogre/OgreMain/src/OgreParticleIterator.cpp\
        ogre/OgreMain/src/OgreParticleSystem.cpp\
        ogre/OgreMain/src/OgreParticleSystemManager.cpp\
        ogre/OgreMain/src/OgrePass.cpp\
        ogre/OgreMain/src/OgrePatchMesh.cpp\
        ogre/OgreMain/src/OgrePatchSurface.cpp\
        ogre/OgreMain/src/OgrePixelCountLodStrategy.cpp\
        ogre/OgreMain/src/OgrePixelFormat.cpp\
        ogre/OgreMain/src/OgrePlane.cpp\
        ogre/OgreMain/src/OgrePlatformInformation.cpp\
        ogre/OgreMain/src/OgrePolygon.cpp\
        ogre/OgreMain/src/OgrePose.cpp\
        ogre/OgreMain/src/OgrePrecompiledHeaders.cpp\
        ogre/OgreMain/src/OgrePredefinedControllers.cpp\
        ogre/OgreMain/src/OgrePrefabFactory.cpp\
        ogre/OgreMain/src/OgreProfiler.cpp\
        ogre/OgreMain/src/OgreProgressiveMesh.cpp\
        ogre/OgreMain/src/OgrePVRTCCodec.cpp\
        ogre/OgreMain/src/OgreQuaternion.cpp\
        ogre/OgreMain/src/OgreRectangle2D.cpp\
        ogre/OgreMain/src/OgreRenderQueue.cpp\
        ogre/OgreMain/src/OgreRenderQueueInvocation.cpp\
        ogre/OgreMain/src/OgreRenderQueueSortingGrouping.cpp\
        ogre/OgreMain/src/OgreRenderSystem.cpp\
        ogre/OgreMain/src/OgreRenderSystemCapabilities.cpp\
        ogre/OgreMain/src/OgreRenderSystemCapabilitiesManager.cpp\
        ogre/OgreMain/src/OgreRenderSystemCapabilitiesSerializer.cpp\
        ogre/OgreMain/src/OgreRenderTarget.cpp\
        ogre/OgreMain/src/OgreRenderTexture.cpp\
        ogre/OgreMain/src/OgreRenderToVertexBuffer.cpp\
        ogre/OgreMain/src/OgreRenderWindow.cpp\
        ogre/OgreMain/src/OgreResource.cpp\
        ogre/OgreMain/src/OgreResourceBackgroundQueue.cpp\
        ogre/OgreMain/src/OgreResourceGroupManager.cpp\
        ogre/OgreMain/src/OgreResourceManager.cpp\
        ogre/OgreMain/src/OgreRibbonTrail.cpp\
        ogre/OgreMain/src/OgreRoot.cpp\
        ogre/OgreMain/src/OgreRotationSpline.cpp\
        ogre/OgreMain/src/OgreSceneManager.cpp\
        ogre/OgreMain/src/OgreSceneManagerEnumerator.cpp\
        ogre/OgreMain/src/OgreSceneNode.cpp\
        ogre/OgreMain/src/OgreSceneQuery.cpp\
        ogre/OgreMain/src/OgreScriptCompiler.cpp\
        ogre/OgreMain/src/OgreScriptLexer.cpp\
        ogre/OgreMain/src/OgreScriptParser.cpp\
        ogre/OgreMain/src/OgreScriptTranslator.cpp\
        ogre/OgreMain/src/OgreSearchOps.cpp\
        ogre/OgreMain/src/OgreSerializer.cpp\
        ogre/OgreMain/src/OgreShadowCameraSetup.cpp\
        ogre/OgreMain/src/OgreShadowCameraSetupFocused.cpp\
        ogre/OgreMain/src/OgreShadowCameraSetupLiSPSM.cpp\
        ogre/OgreMain/src/OgreShadowCameraSetupPlaneOptimal.cpp\
        ogre/OgreMain/src/OgreShadowCameraSetupPSSM.cpp\
        ogre/OgreMain/src/OgreShadowCaster.cpp\
        ogre/OgreMain/src/OgreShadowTextureManager.cpp\
        ogre/OgreMain/src/OgreShadowVolumeExtrudeProgram.cpp\
        ogre/OgreMain/src/OgreSimpleRenderable.cpp\
        ogre/OgreMain/src/OgreSimpleSpline.cpp\
        ogre/OgreMain/src/OgreSkeleton.cpp\
        ogre/OgreMain/src/OgreSkeletonInstance.cpp\
        ogre/OgreMain/src/OgreSkeletonManager.cpp\
        ogre/OgreMain/src/OgreSkeletonSerializer.cpp\
        ogre/OgreMain/src/OgreSmallVector.cpp\
        ogre/OgreMain/src/OgreStaticGeometry.cpp\
        ogre/OgreMain/src/OgreStreamSerialiser.cpp\
        ogre/OgreMain/src/OgreString.cpp\
        ogre/OgreMain/src/OgreStringConverter.cpp\
        ogre/OgreMain/src/OgreStringInterface.cpp\
        ogre/OgreMain/src/OgreSubEntity.cpp\
        ogre/OgreMain/src/OgreSubMesh.cpp\
        ogre/OgreMain/src/OgreTagPoint.cpp\
        ogre/OgreMain/src/OgreTangentSpaceCalc.cpp\
        ogre/OgreMain/src/OgreTechnique.cpp\
        ogre/OgreMain/src/OgreTextAreaOverlayElement.cpp\
        ogre/OgreMain/src/OgreTexture.cpp\
        ogre/OgreMain/src/OgreTextureManager.cpp\
        ogre/OgreMain/src/OgreTextureUnitState.cpp\
        ogre/OgreMain/src/OgreUnifiedHighLevelGpuProgram.cpp\
        ogre/OgreMain/src/OgreUserObjectBindings.cpp\
        ogre/OgreMain/src/OgreUTFString.cpp\
        ogre/OgreMain/src/OgreVector2.cpp\
        ogre/OgreMain/src/OgreVector3.cpp\
        ogre/OgreMain/src/OgreVector4.cpp\
        ogre/OgreMain/src/OgreVertexIndexData.cpp\
        ogre/OgreMain/src/OgreViewport.cpp\
        ogre/OgreMain/src/OgreWindowEventUtilities.cpp\
        ogre/OgreMain/src/OgreWireBoundingBox.cpp\
        ogre/OgreMain/src/OgreWorkQueue.cpp\
        ogre/OgreMain/src/OgreZip.cpp\
        ogre/OgreMain/src/OgreStringSerialiser.cpp\
        ogre/OgreMain/src/Android/OgreTimer.cpp\
        ogre/OgreMain/src/Android/OgreConfigDialog.cpp\
        ogre/OgreMain/src/Android/OgreErrorDialog.cpp\
        ogre/OgreMain/src/Threading/OgreDefaultWorkQueueStandard.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderExIntegratedPSSM3.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderExLayeredBlending.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderExNormalMapLighting.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderExPerPixelLighting.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderExHardwareSkinning.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderFFPColour.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderFFPFog.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderFFPLighting.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderFFPRenderStateBuilder.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderFFPTexturing.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderFFPTransform.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderFunction.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderFunctionAtom.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderGenerator.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderGLSLESProgramProcessor.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderGLSLESProgramWriter.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderMaterialSerializerListener.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderParameter.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderProgram.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderProgramManager.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderProgramProcessor.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderProgramSet.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderProgramWriter.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderProgramWriterManager.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderRenderState.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderScriptTranslator.cpp\
        ogre/Components/RTShaderSystem/src/OgreShaderSubRenderState.cpp\
        ogre/RenderSystems/GLES2/src/OgreGLES2Context.cpp\
        ogre/RenderSystems/GLES2/src/OgreGLES2DefaultHardwareBufferManager.cpp\
        ogre/RenderSystems/GLES2/src/OgreGLES2DepthBuffer.cpp\
        ogre/RenderSystems/GLES2/src/OgreGLES2EngineDll.cpp\
        ogre/RenderSystems/GLES2/src/OgreGLES2FBOMultiRenderTarget.cpp\
        ogre/RenderSystems/GLES2/src/OgreGLES2FBORenderTexture.cpp\
        ogre/RenderSystems/GLES2/src/OgreGLES2FrameBufferObject.cpp\
        ogre/RenderSystems/GLES2/src/OgreGLES2GpuProgram.cpp\
        ogre/RenderSystems/GLES2/src/OgreGLES2GpuProgramManager.cpp\
        ogre/RenderSystems/GLES2/src/OgreGLES2HardwareBufferManager.cpp\
        ogre/RenderSystems/GLES2/src/OgreGLES2HardwareIndexBuffer.cpp\
        ogre/RenderSystems/GLES2/src/OgreGLES2HardwareOcclusionQuery.cpp\
        ogre/RenderSystems/GLES2/src/OgreGLES2HardwarePixelBuffer.cpp\
        ogre/RenderSystems/GLES2/src/OgreGLES2HardwareVertexBuffer.cpp\
        ogre/RenderSystems/GLES2/src/OgreGLES2PixelFormat.cpp\
        ogre/RenderSystems/GLES2/src/OgreGLES2Plugin.cpp\
        ogre/RenderSystems/GLES2/src/OgreGLES2RenderSystem.cpp\
        ogre/RenderSystems/GLES2/src/OgreGLES2RenderTexture.cpp\
        ogre/RenderSystems/GLES2/src/OgreGLES2Support.cpp\
        ogre/RenderSystems/GLES2/src/OgreGLES2Texture.cpp\
        ogre/RenderSystems/GLES2/src/OgreGLES2TextureManager.cpp\
        ogre/RenderSystems/GLES2/src/GLSLES/src/OgreGLSLESExtSupport.cpp\
        ogre/RenderSystems/GLES2/src/GLSLES/src/OgreGLSLESGpuProgram.cpp\
        ogre/RenderSystems/GLES2/src/GLSLES/src/OgreGLSLESLinkProgram.cpp\
        ogre/RenderSystems/GLES2/src/GLSLES/src/OgreGLSLESLinkProgramManager.cpp\
        ogre/RenderSystems/GLES2/src/GLSLES/src/OgreGLSLESProgramCommon.cpp\
        ogre/RenderSystems/GLES2/src/GLSLES/src/OgreGLSLESPreprocessor.cpp\
        ogre/RenderSystems/GLES2/src/GLSLES/src/OgreGLSLESProgram.cpp\
        ogre/RenderSystems/GLES2/src/GLSLES/src/OgreGLSLESProgramFactory.cpp\
        ogre/RenderSystems/GLES2/src/GLSLES/src/OgreGLSLESProgramManagerCommon.cpp\
        ogre/RenderSystems/GLES2/src/GLSLES/src/OgreGLSLESProgramPipeline.cpp\
        ogre/RenderSystems/GLES2/src/GLSLES/src/OgreGLSLESProgramPipelineManager.cpp\
        ogre/RenderSystems/GLES2/src/Android/OgreAndroidGLContext.cpp\
        ogre/RenderSystems/GLES2/src/Android/OgreAndroidGLSupport.cpp\
        ogre/RenderSystems/GLES2/src/Android/OgreAndroidWindow.cpp\
        ogre/PlugIns/ParticleFX/src/OgreAreaEmitter.cpp\
        ogre/PlugIns/ParticleFX/src/OgreBoxEmitter.cpp\
        ogre/PlugIns/ParticleFX/src/OgreColourFaderAffector.cpp\
        ogre/PlugIns/ParticleFX/src/OgreColourFaderAffector2.cpp\
        ogre/PlugIns/ParticleFX/src/OgreColourImageAffector.cpp\
        ogre/PlugIns/ParticleFX/src/OgreColourInterpolatorAffector.cpp\
        ogre/PlugIns/ParticleFX/src/OgreCylinderEmitter.cpp\
        ogre/PlugIns/ParticleFX/src/OgreDeflectorPlaneAffector.cpp\
        ogre/PlugIns/ParticleFX/src/OgreDirectionRandomiserAffector.cpp\
        ogre/PlugIns/ParticleFX/src/OgreEllipsoidEmitter.cpp\
        ogre/PlugIns/ParticleFX/src/OgreHollowEllipsoidEmitter.cpp\
        ogre/PlugIns/ParticleFX/src/OgreLinearForceAffector.cpp\
        ogre/PlugIns/ParticleFX/src/OgreParticleFXPlugin.cpp\
        ogre/PlugIns/ParticleFX/src/OgrePointEmitter.cpp\
        ogre/PlugIns/ParticleFX/src/OgreRingEmitter.cpp\
        ogre/PlugIns/ParticleFX/src/OgreRotationAffector.cpp\
        ogre/PlugIns/ParticleFX/src/OgreScaleAffector.cpp
     
    LOCAL_STATIC_LIBRARIES := libfreeimage libft2 libzzip
     
    include $(BUILD_SHARED_LIBRARY)
    
    

    Application.mk

    APP_OPTIM := release
    APP_PLATFORM := android-8
    APP_PLATFORM := gnustl_static
    APP_CPPFLAGS += -frtti
    APP_CPPFLAGS += -fexceptions
    APP_CPPFLAGS += -DANDROID
    APP_MODULES := ogre
    
    

    编译前,做一些小的修改,ogre/Components/RTShaderSystem/OgreShaderGLSLESProgramWriter.cpp,在头文件包含中加入一行:

    #include “OgreLogManager.h”

    进入目录OGRE,执行ndk-build -j4。到此大功告成。

    5.后记

    移植并不是很完美,FreeImage很多图片格式无法支持,有点遗憾。移植好的代码我放到了Github上,地址是 https://github.com/cloudstrifegit/ogre-android,欢迎指正。

    展开全文
  • 第一步 ,配置所需Android环境: 1. adt 本文采用adt-bundle-windows-x86-20130522 打开链接 2. ndk 本文采用r8d ndk 3、OgreSDK_Android_v1-9-0RC1 可以官网下载,也可以在云盘下载 链接:...

     第一步  ,配置所需Android环境:

    1. adt  本文采用adt-bundle-windows-x86-20130522 打开链接

    2. ndk 本文采用r8d  ndk

    3、OgreSDK_Android_v1-9-0RC1 可以官网下载,也可以在云盘下载  链接:http://pan.baidu.com/s/1kT91uHh 密码:t6ar

    4、java所需环境  jdk ,用1.7版本的就可以。并配置环境变量(不知道不用行不行)


    第二步 ,采用android_native_app_glue 方式,编写纯c++的Android程序。

    视频教程:点击打开链接

    文本教程:点击打开链接

    第三步,解压OgreSDK_Android_v1-9-0RC1,将Ogre Android SDK\Samples\GLES1\bin目录中的apk安装到Android装备上,运行一下看看效果。是个红色背景的恶魔。你可以修改工程中的背景色看看,不会成功的,因为没法生存so。所以,第四步。


    第四步,将ogre的移植上来。需要做的修改

       1、将ogresdk压缩包解压后将目录下的Ogre  和Dependencies文件夹放置到 第二步中的工程文件夹同级目录中。

    2、修改mk文件。Android.mk文件,修改为

    LOCAL_PATH := $(call my-dir)
    include $(CLEAR_VARS)
     
        LOCAL_MODULE    := NDKTest  ----你自己的工程名
    
        LOCAL_LDLIBS	:= -landroid -lc -lm -ldl -llog -lEGL -lGLESv1_CM
        LOCAL_LDLIBS	+= -L$(LOCAL_PATH)/../../Ogre/lib/armeabi-v7a -L$(LOCAL_PATH)/../../Dependencies/lib/armeabi-v7a
        LOCAL_LDLIBS	+= -lPlugin_ParticleFXStatic -lPlugin_OctreeSceneManagerStatic -lRenderSystem_GLESStatic -lOgreOverlayStatic -lOgreMainStatic
        LOCAL_LDLIBS	+= -lzzip -lz -lFreeImage -lfreetype -lOIS  $(LOCAL_PATH)/../../Dependencies/lib/armeabi-v7a/libsupc++.a $(LOCAL_PATH)/../../Dependencies/lib/armeabi-v7a/libstdc++.a ./obj/local/armeabi-v7a/libcpufeatures.a
        LOCAL_STATIC_LIBRARIES := android_native_app_glue cpufeatures
        
        LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES=1 -I$(LOCAL_PATH)/../../Ogre/include/Build -I$(LOCAL_PATH)/../../Ogre/include/OgreMain -I$(LOCAL_PATH)/../../Ogre/include/RenderSystems/GLES
        LOCAL_CFLAGS += -I$(LOCAL_PATH)/../../Ogre/include/RenderSystems/GLES/EGL -I$(ANDROID_NDK)/sources/cpufeatures -I$(LOCAL_PATH)/../../Ogre/include/Components/Overlay 
        LOCAL_CFLAGS += -I$(LOCAL_PATH)/../../Ogre/include/PlugIns/ParticleFX -I$(LOCAL_PATH)/../../Ogre/include/PlugIns/OctreeSceneManager 
        LOCAL_CFLAGS += -I$(LOCAL_PATH)/../../Dependencies/include -I$(LOCAL_PATH)/../../Dependencies/include/OIS 
        LOCAL_CFLAGS += -fexceptions -frtti -x c++ -D___ANDROID___ -DANDROID -DZZIP_OMIT_CONFIG_H 
        
        LOCAL_PATH := ./jni
        LOCAL_SRC_FILES := NDKTest.cpp 
            
        include $(BUILD_SHARED_LIBRARY) 
          
        $(call import-module,android/cpufeatures) 
        $(call import-module,android/native_app_glue) 

    Application.mk文件修改为(因为x86的有些平板不行)

    APP_ABI := armeabi-v7a
    APP_STL := gnustl_static 

    3、修改自己的cpp文件

    #include <jni.h>
    
    #include <android/native_window.h>
    #include <android_native_app_glue.h>
    #include <android/log.h>
    #include <stdio.h>
    
    
    
    
    #define OGRE_STATIC_GLES
    #define OGRE_STATIC_ParticleFX
    #define OGRE_STATIC_OctreeSceneManager
    #include "OgreStaticPluginLoader.h"
    
    #include "Ogre.h"
    #include "OgreRenderWindow.h"
    #include "OgreStringConverter.h"
    #include "Android/OgreAndroidEGLWindow.h"
    #include "Android/OgreAPKFileSystemArchive.h"
    #include "Android/OgreAPKZipArchive.h"
    
    #include <EGL/egl.h>
    #include <android/log.h>
    #include <android_native_app_glue.h>
    
    //#include "MCameraMan.h"
    
    
    
    
    
    
    static Ogre::RenderWindow* gRenderWnd = NULL;
    static Ogre::Root* gRoot = NULL;
    static Ogre::StaticPluginLoader* gStaticPluginLoader = NULL;
    static AAssetManager* gAssetMgr = NULL; 
    static Ogre::SceneManager* gSceneMgr = NULL;
    static Ogre::Camera* gCamera=NULL;
    static Ogre::SceneNode* gNode=NULL;
    
    //static MCameraMan* gCamMan=NULL;
    
    static Ogre::DataStreamPtr openAPKFile(const Ogre::String& fileName)
    {
    	Ogre::DataStreamPtr stream;
    	AAsset* asset = AAssetManager_open(gAssetMgr, fileName.c_str(), AASSET_MODE_BUFFER);
    	if(asset)
    	{
    		off_t length = AAsset_getLength(asset);
    		void* membuf = OGRE_MALLOC(length, Ogre::MEMCATEGORY_GENERAL);
    		memcpy(membuf, AAsset_getBuffer(asset), length);
    		AAsset_close(asset);
    
    		stream = Ogre::DataStreamPtr(new Ogre::MemoryDataStream(membuf, length, true, true));
    	}
    	return stream;
    }
    
    static void setupScene()
    {
    	Ogre::ConfigFile cf;
    	cf.load(openAPKFile("resources.cfg"));
    
    	Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
    	while (seci.hasMoreElements())
    	{
    		Ogre::String sec, type, arch;
    		sec = seci.peekNextKey();
    		Ogre::ConfigFile::SettingsMultiMap* settings = seci.getNext();
    		Ogre::ConfigFile::SettingsMultiMap::iterator i;
    
    		for (i = settings->begin(); i != settings->end(); i++)
    		{
    			type = i->first;
    			arch = i->second;
    			Ogre::ResourceGroupManager::getSingleton().addResourceLocation(arch, type, sec);
    		}
    	}
    
    	Ogre::ResourceGroupManager::getSingletonPtr()->initialiseResourceGroup(Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    
    	gSceneMgr = gRoot->createSceneManager(Ogre::ST_GENERIC);
    	Ogre::Camera* camera = gSceneMgr->createCamera("MyCam");
    	gCamera=camera;
    	//gCamMan=new MCameraMan(camera);
    
    	Ogre::Entity* pEntity = gSceneMgr->createEntity("SinbadInstance", "Sinbad.mesh");
    	Ogre::SceneNode* pNode = gSceneMgr->getRootSceneNode()->createChildSceneNode();
    	pNode->attachObject(pEntity);
    	gNode=pNode;
    
    	Ogre::Light* pDirLight = gSceneMgr->createLight();
    	pDirLight->setDirection(Ogre::Vector3(0,-1,0));
    	pDirLight->setType(Ogre::Light::LT_DIRECTIONAL);
    	pNode->attachObject(pDirLight);
    
    	camera->setNearClipDistance(1.0f);
    	camera->setFarClipDistance(100000.0f);
    	camera->setPosition(0,0,20.0f);
    	camera->lookAt(0,0,0);
    	camera->setAutoAspectRatio(true);
    
    	Ogre::Viewport* vp = gRenderWnd->addViewport(camera);
    	vp->setBackgroundColour(Ogre::ColourValue(0,0,0));
    }
    
    static int32_t handleInput(struct android_app* app, AInputEvent* event) 
    {
    	if (AInputEvent_getType(event) == AINPUT_EVENT_TYPE_MOTION) {
    		int nNum = AMotionEvent_getPointerCount(event);
    		char szTrace[1024] = {0};
    		sprintf (szTrace, "engine_handle_input num=[%d]", nNum);
    		int xpos=0;
    		int ypos=0;
    		for (int nIdx = 0; nIdx < nNum; nIdx++)
    		{
    			int nX = AMotionEvent_getX(event, 0);
    			int nY = AMotionEvent_getY(event, 0);
    			xpos=nX;
    			ypos=nY;
    			sprintf (strrchr(szTrace, 0), " (%d %d)", nX, nY);
    		}
    		__android_log_print(ANDROID_LOG_DEBUG, "ndktest",
    			"%s", szTrace);
    
    		static int x_zdel=xpos;
    		static int y_zdel=ypos;
    		sprintf(szTrace,"") ;
    
    
    
    
    		if( AMotionEvent_getAction(event)== AMOTION_EVENT_ACTION_MOVE)
    		{
    			x_zdel=xpos-x_zdel;
    			y_zdel=ypos-y_zdel;
    			//gCamera->lookAt(x_zdel,y_zdel,0);
    <span style="white-space:pre">			</span>//移动node
    			gNode->translate(x_zdel/10,y_zdel/10,0);
    			//gCamMan->getCamera()->yaw(Ogre::Degree(x_zdel*0.1));
    			//gCamMan->getCamera()->pitch(Ogre::Degree(y_zdel*0.1));
    			sprintf (szTrace, " move =(%d %d)", x_zdel,y_zdel);
    			__android_log_print(ANDROID_LOG_DEBUG, "ndktest",
    														"%s", szTrace);
    
    			x_zdel=xpos;
    			y_zdel=ypos;
    		}
    		else if(AMotionEvent_getAction(event)== AMOTION_EVENT_ACTION_DOWN)
    		{
    			x_zdel=xpos;
    			y_zdel=ypos;
    		}
    		else if(AMotionEvent_getAction(event)== AMOTION_EVENT_ACTION_UP)
    		{
    
    		}
    
    		sprintf (szTrace, " xypos=(%d %d)", x_zdel,y_zdel);
    				__android_log_print(ANDROID_LOG_DEBUG, "ndktest",
    							"%s", szTrace);
    
    
    
    
    
    		if (AKeyEvent_getAction(event) != AKEY_EVENT_ACTION_UP)
    		{
    			sprintf(szTrace,"key up") ;
    			__android_log_print(ANDROID_LOG_DEBUG, "ndktest",
    											"%s", szTrace);
    						return 1;
    		}
    
    	
    
    
    
    
    			return 1;
    	}
    	return 0;
    }
    
    static void handleCmd(struct android_app* app, int32_t cmd)
    {
    	switch (cmd) 
    	{
    	case APP_CMD_SAVE_STATE:
    		break;
    	case APP_CMD_INIT_WINDOW:
    		if(app->window && gRoot)
    		{
    			AConfiguration* config = AConfiguration_new();
    			AConfiguration_fromAssetManager(config, app->activity->assetManager);
    			gAssetMgr = app->activity->assetManager;
    
    			if(!gRenderWnd)
    			{
    				Ogre::ArchiveManager::getSingleton().addArchiveFactory( new Ogre::APKFileSystemArchiveFactory(app->activity->assetManager) );
    				Ogre::ArchiveManager::getSingleton().addArchiveFactory( new Ogre::APKZipArchiveFactory(app->activity->assetManager) );
    
    				Ogre::NameValuePairList opt;
    				opt["externalWindowHandle"] = Ogre::StringConverter::toString((int)app->window);
    				opt["androidConfig"] = Ogre::StringConverter::toString((int)config);
    
    				gRenderWnd = gRoot->createRenderWindow("OgreWindow", 0, 0, false, &opt); 
    
    				setupScene();
    			}
    			else
    			{
    				static_cast<Ogre::AndroidEGLWindow*>(gRenderWnd)->_createInternalResources(app->window, config);
    			}
    			AConfiguration_delete(config);
    		}
    		break;
    	case APP_CMD_TERM_WINDOW:
    		if(gRoot && gRenderWnd)
    			static_cast<Ogre::AndroidEGLWindow*>(gRenderWnd)->_destroyInternalResources();
    		break;
    	case APP_CMD_GAINED_FOCUS:
    		break;
    	case APP_CMD_LOST_FOCUS:
    		break;
    	}
    }
    
    void android_main(struct android_app* state)
    {
    	app_dummy();
    
    	if(gRoot == NULL)
    	{
    		gRoot = new Ogre::Root();
    #ifdef OGRE_STATIC_LIB
    		gStaticPluginLoader = new Ogre::StaticPluginLoader();
    		gStaticPluginLoader->load();
    #endif
    		gRoot->setRenderSystem(gRoot->getAvailableRenderers().at(0));
    		gRoot->initialise(false);
    	}
    
    
    	state->onAppCmd = &handleCmd;
    	state->onInputEvent = &handleInput;
    
    	int ident, events;
    	struct android_poll_source* source;
    
    	while (true)
    	{
    		while ((ident = ALooper_pollAll(0, NULL, &events, (void**)&source)) >= 0)
    		{
    			if (source != NULL)
    				source->process(state, source);
    
    			if (state->destroyRequested != 0)
    				return;
    		}
    
    		if(gRenderWnd != NULL && gRenderWnd->isActive())
    		{
    			gRenderWnd->windowMovedOrResized();
    			gRoot->renderOneFrame();
    		}
    	}
    }

    最后运行,成功。

    展开全文
  • 基于ogre开源引擎的android原生开发资料很少,感觉ogre开源社区也没太重视android方面的缺陷修改,android切后台崩溃问题,早在2012年就在ogre社区的存在,直到现在问题依旧没有解决。基于ogre1.9源码当android切换...

    基于ogre开源引擎的android原生开发资料很少,感觉ogre开源社区也没太重视android方面的缺陷修改,android切后台崩溃问题,早在2012年就在ogre社区的存在,直到现在问题依旧没有解决。基于ogre1.9源码

    当android切换后台回来时候,常见问题是发生了崩溃,java.lang.RuntimeException: eglSwapBuffers failed: EGL_BAD_ALLOC这个错误较多,即使做了控制,在切后台的时候停止渲染,切换回来再开启渲染,但是也会发生黑屏,最不济的方式每次切换需要释放,重新创建ogre的窗口,但是整个ogre状态发生了很多改变,7.0以上的android系统设备容易崩溃,深度检测,pass,状态等等都发生了改变。

    查阅了很多资料,网上大概有以下几个方式,我都试过,都没有成功。

    1.

    做ogre1.9 的 android版本适配时发现原有的gl上下文丢失会导致原有贴图资源全部失效,

    而这个情况的发生仅仅是由app切进切出后台触发.找了一圈后发现ogre 1.10新版本已经解决了这个问题。

    通过对比ogre1.9 和ogre1.10,整个代码结构差异大,移植升级风险大,没具体操作。

    2 ogre forums  上面关于这方面方法都试过,都没有成功,举其中一例

    void AndroidEGLWindow::_resetContext()
        {
            mContext->endCurrent();
            mContext->setCurrent();
        }

    这个方法,也都没有成功,不过给了我很大启示,说明了切换后台会导致上下文发生了变化,所以造成了状态变化。

    最后通过对ogre源码上下文进行修改,最终整个不会崩溃,ogre状态也正常, 本文就不具体贴出方法。


    Ogre Forums
    展开全文
  • 后来才发现有个非常简洁的途径, 我在上面成功实现了C++ ,Ogre移植到手机上,现给大家做参考。 第一步: 安装jdk。 第二步: 去 http://developer.android.com/sdk/index.html,下载eclipse + ...

    起初,用纯eclipse 配置android ndk开发环境,浪费了我好多时间。 倒腾了一个星期。 后来才发现有个非常简洁的途径, 我在上面成功实现了C++ ,Ogre移植到手机上,现给大家做参考。



    第一步: 安装jdk。
    第二步: 去 http://developer.android.com/sdk/index.html,下载eclipse + android 集成开发环境  adt-bundle-linux-x86-20140321.zip。 

    第三步: 解压zip包, 运行eclipse, 默认sdk, adt, cdt 插件都有, 看实际情况sdk可以不用更新,直接用包里的也行。

    第三步: 下载ndk: http://developer.android.com/tools/sdk/ndk/index.html,     android-ndk-r9d-linux-x86.tar.bz2, 解压, 在eclipse 指定ndk路径。 


    至此: android  ndk 开发环境就配置完了。 下面说说怎样用这个环境开发android程序。 由于我是要把ogre 程序移植到 手机上, 所以用了ogre sdk 里面的一个例子做实践。

    其他人可以用ndk -> sample  里自带的例子。 


    第一步: 打开Eclipse。 

    第二步: file -> new -> other -> android project from existing code , next。 

    第三步: root directory 中选择你的 ndk 工程(就是带有jni的目录,详细见ndk 中的例子), 我这里选择ogre sdk 中的ndk 例子: /home/administrator/dev/AndroidOgreSdk/Samples/GLES2;然后, finish 完成项目创建;

    第四步:   现在的项目是java类型的,  要想调试得把项目转换成c++的。具体方法是: 项目右键->new -> other-> convert to c/c++..., 点 next。

    第五步: 关键,要在 project  type 中选择 makefile project. , toolchains 中选择 linux  gcc;     点 finish。

    第六步: 关键, 项目右键->properties-> c/c++ build -> build command 改成  ndk路径 +/ndk-build,  我的是 /home/administrator/dev/AndroidNdk/ndk-build;

    第七步: 编译工程,此时如果 项目下的  AndroidManifest.xml 是从widnows上拷贝过来的,可能回报  Android NDK: WARNING: APP_PLATFORM android-14 is larger than android:minSdkVersion 的错误, 应为windows 和 linux 字符编码不一样。解决办法 有两种:

    (7.1) :用命令转成linux字符, cat AndroidManifest.xml | col -b > AndroidManifest.xml2 , mv AndroidManifest.xml2 AndroidManifest.xml

    (7.2): 简单方法, 在eclipse环境中打开 AndroidManifest.xml 剪切内容,粘贴,保存。 

    第八步: 编译工程, 此时可能会抱 ***.o.d:1: *** multiple target patterns.  Stop, 这是由于 o.d.1文件是旧的, 干掉就行, 在obj 目录下。

     第九步: 如果顺利,就可以编译成.so了, 点eclipse 绿色运行三角块, 生成apk, 启动android模拟器,就可以看到我的运行结果了。 




    展开全文
  • irrlicht移植android

    2010-07-07 23:37:00
    所以一直想把它移植android上面去,还有一个原因就是irrlicht里面没有使用STL,像ogre这样很多游戏引擎都在使用STL,irrlicht自己实现简单的alloc、list、map等数据结构,这也是移植irrlicht的原因之一。...
  • 随着android在全球的风靡,越来越多的人将自己的目光投向搭载android的移动设备,但由于手持设备的局限性,怎样利用有限的资源来达到很好的体验,是设备厂商必须要考虑的问题,其中炫目的界面就是可以增加用户体验的...
  • 背景:ogre 移植android,需要在本地PC练习。 环境:ubuntu 10.04 1 更新apt-get的Ogre源: $ sudo add-apt-repository ppa:ogre-team/ogre 并 sudo apt-get update 2 安装Ogre相关: $ sudo apt-get...
1 2 3 4 5 ... 20
收藏数 633
精华内容 253
热门标签