• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            我這個人記性不好,學過的東西老是愛忘,學得越多忘得越快,腦子和我可憐的硬盤一樣容量比較小,所以我發現我不得不把有些東西記錄下來。其實學一樣東西關鍵在于多學多用,有道是書讀百遍其意自現,對于我這種比較笨又沒天賦的人來說可謂金玉良言了。
            以上算前言吧,下邊才是正文。

            Ogre這個引擎的效率不知道實際應用起來如何,但是聽說結構倒是比較好的。選擇它來學習主要是因為它開源,而且是C++和Dx寫的,關鍵還有資料比較多,國內研究的也比較多,也有一些教程,不過Ogre不斷推出新版本,許多教程都有點過期了。要了解最新的使用方法還得看官方的教程。我也是直接看官方的教程,但是英文一般,每次打開大片英文頁面看著的確比較迷糊,所以我打算把里面一些重要的關鍵部分節選出來以備參考,有時候可以快速的重溫,比如這篇要介紹的如何配置Ogre,需要記嗎?程序員記不了那么多啦,用的時候再查。當然Ogre也在持續更新,如果我個人還在持續學習使用Ogre,那么我也會持續更新這些教程的,如果你是Ogre的使用者記得來我的Blog:http://www.shnenglu.com/singohgod?看看吧,希望能對大家有點幫助。

            首先安裝SDK,可以編譯里面帶的示例看看一些效果展示。編譯源碼就得下載源碼吧,記得還要下一個Dependencies,解壓到源碼目錄就可以了,編譯應該能通過的,我這里沒有遇到問題。

            不要被繁多的目錄和文件嚇著了,其實運行Ogre程序只需要下列庫和文件:
            OGRE Libraries & Files

            • OGRE libraries (OgreMain[_d].dll, OgrePlatform[_d].dll or libOgreMain.so, libOgrePlatform.so for linux).
            • plugins.cfg - Text file specifying the rendering libraries available to Ogre (ie DX9, OpenGL).
            • All the plugin libraries listed in plugins.cfg (you can remove items from plugins.cfg if you don't wish to use them).
            • resources.cfg - If using the ExampleApplication, a text file specifing paths to materials, textures, models, etc.
            • OgreCore.zip - Ensure resources.cfg has the proper path to this file if you plan to use the OGRE debug panel or profiler.
            • Other Resources used in your program (*.zip; *.png; *.particle; *.mesh; ...).

            還需要其他的第三方庫:
            These are required:

            • Zlib: zlib1.dll; libz.so (debian: zlib1g, zlib1g-dev)
            • DevIL: devil.dll, ilu.dll, ilut.dll; libIL.so, libILU.so (debian: libdevil1, libdevil-dev)

            These are optional:

            • CEGUI: OgreGUIRenderer[_d].dll, CEGUIBase[_d].dll, CEGUITaharezLook[_d].dll, CEGUIWindowsLook[_d].dll, xerces-c_2_5_0.dll
            • CEGUI: libCEGUIBase.so, libCEGUIOgreRenderer.so, libxerces-c.so (debian: libcegui-mk2-0, libcegui-mk2-dev, libxerces26, libxerces26-dev)
            • Cg: cg.dll; libCg.so (debian: nvidia-cg-toolkit)
            • OpenEXR: openexr.dll??; (debian: libopenexr-dev libopenexr2 )
            • ReferenceApp: ReferenceAppLayer.dll

            不同的編譯器還需要有:
            Extras for Microsoft Visual C++ 6 (SP3+)

            • stlport_vc6[_stldebug]46.dll
            • msvcp60[D].dll
            • msvcrt[D].dll
            Extras for Microsoft Visual C++.Net 2002
            • stlport_vc7[_stldebug]46.dll
            • msvcp70[d].dll
            • msvcr70[d].dll
            Extras for Microsoft Visual C++.Net 2003
            • msvcp71[d].dll
            • msvcr71[d].dll
            Extras for Mingw + STLPort
            • libstlport[stlg].5.0.dll
            • mingwm10.dll


            設置環境變量:
            If you downloaded and installed the precompiled OGRE SDK, you should already have an environment variable called 'OGRE_HOME' registered already, pointing at the folder where you installed. If it isn't there you probably installed under a different user, so define OGRE_HOME manually

          1. If you downloaded the source distribution, you should register a new environment variable OGRE_SRC pointing at the 'ogrenew' folder from the OGRE source

            Ogre源碼項目的目錄結構:
            work_dir
            ??? include
            ?????? *.h
            ??? src
            ?????? *.cpp
            ??? scripts
            ?????? *.vcproj

            新建項目也依據這個結構,你的項目應該有這些文件夾:'bin', 'include', 'media', 'testsolution', 'scripts', and 'src'

            修改新項目的屬性:
            Debugging?: Working Directory?????????????????????? = ..\bin\Debug
            C/C++?: Preprocessor?: Preprocessor Definitions += _STLP_DEBUG (only in Debug mode, not needed for .Net 2003 and 2005)
            C/C++?: Code Generation?: Use runtime library = Multithreaded Debug DLL (Multithreaded DLL in Release)
            Linker?: General?: Output File??????????????????????????? = ..\bin\Debug\[appname].exe
            Linker?: Input?: Additional Dependencies??????????????? += OgreMain_d.lib (OgreMain.lib in Release)

            如果你是安裝SDK:

            C/C++?: General?: Additional Include Directories 	 = ..\include;$(OGRE_HOME)\include;$(OGRE_HOME)\samples\include
            Linker?: General?: Additional Library Directories         = $(OGRE_HOME)\lib
            

            如果你是編譯源碼:

            C/C++?: General?: Additional Include Directories 	 = ..\include;$(OGRE_SRC)\OgreMain\include;$(OGRE_SRC)\Samples\Common\Include
            Linker?: General?: Additional Library Directories         = $(OGRE_SRC)\OgreMain\Lib\Debug

            這些設置好以后你就可以新建一個SampleApp.cpp文件,然后拷貝如下代碼:




            #include?"ExampleApplication.h"

            //?Declare?a?subclass?of?the?ExampleFrameListener?class
            class?MyListener?:?public?ExampleFrameListener
            {
            public:
            ????MyListener(RenderWindow
            *?win,?Camera*?cam)?:?ExampleFrameListener(win,?cam)
            ????
            {
            ????}


            ????
            bool?frameStarted(const?FrameEvent&?evt)
            ????
            {
            ????????
            return?ExampleFrameListener::frameStarted(evt);????????
            ????}


            ????
            bool?frameEnded(const?FrameEvent&?evt)
            ????
            {
            ????????
            return?ExampleFrameListener::frameEnded(evt);????????
            ????}

            }
            ;

            //?Declare?a?subclass?of?the?ExampleApplication?class
            class?SampleApp?:?public?ExampleApplication?
            {
            public:
            ???SampleApp()?
            ???
            {
            ???}


            protected:
            ???
            //?Define?what?is?in?the?scene
            ???void?createScene(void)
            ???
            {
            ???????
            //?put?your?scene?creation?in?here
            ???}

            ??
            ???
            //?Create?new?frame?listener
            ???void?createFrameListener(void)
            ???
            {
            ???????mFrameListener?
            =?new?MyListener(mWindow,?mCamera);
            ???????mRoot
            ->addFrameListener(mFrameListener);
            ???}

            }
            ;

            #ifdef?__cplusplus
            extern?"C"?{
            #endif

            #if?OGRE_PLATFORM?==?OGRE_PLATFORM_WIN32?
            #define?WIN32_LEAN_AND_MEAN?
            #include?
            "windows.h"?
            INT?WINAPI?WinMain(HINSTANCE?hInst,?HINSTANCE,?LPSTR?strCmdLine,?INT)?
            #else?
            int?main(int?argc,?char?**argv)?
            #endif?
            {
            ????
            //?Instantiate?our?subclass
            ????SampleApp?myApp;

            ????
            try?{
            ????????
            //?ExampleApplication?provides?a?go?method,?which?starts?the?rendering.
            ????????myApp.go();
            ????}

            ????
            catch?(Ogre::Exception&?e)?{
            #if?OGRE_PLATFORM?==?OGRE_PLATFORM_WIN32?
            ????????MessageBoxA(NULL,?e.getFullDescription().c_str(),?
            "An?exception?has?occured!",?MB_OK?|?MB_ICONERROR?|?MB_TASKMODAL);
            #else
            ????????std::cerr?
            <<?"Exception:\n";
            ????????std::cerr?
            <<?e.getFullDescription().c_str()?<<?"\n";
            #endif
            ????????
            return?1;
            ????}


            return?0;
            }


            #ifdef?__cplusplus
            }

            #endif

            未完!
          2. posted on 2006-07-18 12:09 大寶天天見 閱讀(2353) 評論(0)  編輯 收藏 引用 所屬分類: 4.2D/3D Engine
            久久天天躁夜夜躁狠狠| 婷婷久久香蕉五月综合加勒比| 久久国产成人亚洲精品影院| 久久久久久久综合日本| 久久久久久久久久久精品尤物| 日韩精品久久无码中文字幕| 国产99久久久国产精免费| 色8激情欧美成人久久综合电| 精品久久久无码人妻中文字幕豆芽| 精品免费久久久久国产一区| 一本一本久久A久久综合精品| 久久不射电影网| 久久久久av无码免费网| 久久av免费天堂小草播放| 国产亚洲精久久久久久无码| 欧美国产成人久久精品| 国产欧美久久一区二区| 国产成人无码精品久久久性色 | 久久www免费人成看国产片| 天天躁日日躁狠狠久久| 久久99热这里只有精品66| 99久久国产综合精品麻豆| 77777亚洲午夜久久多喷| 人妻少妇精品久久| 久久久久亚洲AV成人网人人网站 | 人人狠狠综合久久亚洲婷婷| 亚洲国产精品无码久久一区二区| 欧美性大战久久久久久| 精品熟女少妇aⅴ免费久久| 久久99精品国产99久久| 精品乱码久久久久久久| 777米奇久久最新地址| 伊人久久综合无码成人网| 久久天天躁狠狠躁夜夜2020一| 亚洲人成网站999久久久综合 | 亚洲欧美国产日韩综合久久| 久久久久久国产a免费观看不卡| 国内精品久久久久久不卡影院| 91超碰碰碰碰久久久久久综合| 久久精品一区二区| 亚洲国产成人久久精品99 |