OGRE (Object-Oriented Graphics Rendering Engine)
Creating project files for OGRE
Files
In these tutorials I will assume that the projects being created are located in their own folder in OgreNew\Samples. I will use APPNAME as a place holder for where you type in the name of the application. So in the example of where the project files should be stored it would be OgreNew\Samples\APPNAME.
NB: In a moments time we will embark on creating a small application called "Space", based on some of the examples supplied with Ogre. I suggest that if you plan on doing that tutorial that you use Space as the APPNAME.
Visual C++ 7
The first thing you need to do is create a blank Win32 Project.
Make sure that you create a C++ project and that you have ticked the "Empty Project" tick box.
Now right click on the project in the solution explorer and change the following properties:
Debug - Working Directory | = | ..\Common\Bin\Debug |
C/C++ - Preprocessor Defines | = | _WINDOWS,_STLP_USE_DYNAMIC_LIB,OGRE_LIBRARY_IMPORTS,_DEBUG,WIN32 |
C/C++ - Additional Include Directories | = | ..\Common\Include |
Linker - Output File | = | ..\Common\Bin\Debug\APPNAME.EXE |
Linker - Additional Library Directories | = | ..\..\OgreMain\Lib\Debug |
Linker - Additional Dependencies | = | OGREMain.LIB |
Copy Samples\Skyplane\Src\SkyPlane.CPP and Samples\Skyplane\Include\SkyPlane.H into the directory with your project. Right click on the project in the solution explorer and select "Add Existing Item". Highlight the two files you just copied and then rebuild your solution. Now run it in debug mode. Everything should work.
Now remove those two files from your project and delete them from your projects directory.
The last step that we need to take in setting up the project is to create the main program loop. This is simpler than it sounds because if we are following the Ogre Example Framework then all it means we do is create an instance of our Application object and call it's go() method. In Visual C++ it will look like this:
/* APPNAME.CPP */ #include "Ogre.h" #include "APPNAMEApplication.h" #define WIN32_LEAN_AND_MEAN #include "windows.h" INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT ) { // Create application object APPNAMEApplication app; try { app.go(); } catch( Ogre::Exception& e ) { MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL ); } return 0; }
This doesn't compile does it? No, because we have not written APPNAMEApplication.h yet. That will be discussed in the next section.
Visual C++ 6
Under construction.
Linux
Under construction.
Borland
Under construction.
Back to Index | << Previous section | Next section >> |