History: OgreBullet Tutorial 1
Source of version: 6 (current)
Copy to clipboard
Hi! This tutorial will guide you through the configuration of an OgreBullet project from configuring the components to creating your first compilable but empty project. My native language is not English so if you find grammatical errors, please post a comment. Thanks! __What you need:__ - Ogre 1.65 (must be already configured). ''This tutorial has also been reported to be compatible with Ogre 1.7.1''. - Bullet 2.76 (you can download from [http://code.google.com/p/bullet/downloads/list|here]) - OgreBullet (I used rev. 2902, svn at the time of writing: [https://ogreaddons.svn.sourceforge.net/svnroot/ogreaddons/trunk/ogrebullet|link]) __IDE I used and will refer to:__ - Visual Studio 2008 C++ Express with SP1 __Also good if you have:__ - Ogre AppWizard (the basic project is generated with this. Wiki: ((The Complete Blanks Guide To Using The OGRE SDK AppWizard))) !Preparation __Unpack Bullet and place OgreBullet somewhere on the hard drive.__ __Create a new environment variable for Bullet.__ ''BULLET_HOME'': C:\OgreSDK\AddOns\bullet-2.76 (if this is where you unpacked Bullet). __Note:__ At least as of revision 2978, the project is configured to use the environment variable ''BULLET_ROOT'' instead. __Note:__ You can set environment variables in Windows XP by following these steps: open Control Panel (classic view) / System / Advanced / Environment Variables. Set it in the User Variables box. __Build Bullet in your IDE (I did it in VS2008 Express).__ From Bullet's root folder, the project file for VS 2008 is here: msvc/2008/BULLET_PHYSICS.sln. Build it in __Debug__ and __Release__ modes; it should compile without any problem. __Build OgreBullet.__ The .sln file is in the OgreBullet folder. Depending on your version, it may be called OgreBullet_SDK.sln or OgreBullet_VC8.sln. __Note:__ You may need to alter Include directories if you're using a newer version of Ogre. When you build the debug version of the demos, you may have some errors about missing .lib files. Put these files in ....\OgreBullet\lib\Debug\: {FANCYTABLE(head="File | Can be found in")} __BulletCollision.lib__|....\bullet-2.76\msvc\2008\src\BulletCollision\Debug\ __BulletDynamics.lib__| ....\bullet-2.76\msvc\2008\src\BulletDynamics\Debug\ __ConvexDecomposition.lib__|....\bullet-2.76\msvc\2008\Extras\ConvexDecomposition\Debug\ __GIMPACTUtils.lib__| ....\bullet-2.76\msvc\2008\Extras\GIMPACTUtils\Debug\ __LinearMath.lib__| ....\bullet-2.76\msvc\2008\src\LinearMath\Debug\{FANCYTABLE} There are some other files that we don't need now but that you may need later, for example __BulletSoftBody.lib__. If something is missing when you use more components from Bullet, don't forget to copy it to the right place. __Note:__ If you want to compile/run the OgreBullet demos supplied with OgreBullet and it can't find resources.cfg, don't wonder. This tutorial is not about these demos but I think you can solve this problem yourself. There are some problems with paths :) If you want to build the __Release__ version of the demos (or any OgreBullet project!) you'll need to copy Bullet's __.lib__ files to ....\OgreBullet\lib\Release. But beware! You have to put the __RELEASE__ version of the __.lib__ files to this directory, not the files listed above. Now that we have the required files, let's close this project and start a new one! !Create an empty project with Bullet support If you have the Ogre AppWizard installed, create a new Ogre project: New project –> Ogre SDK Application –> __OgreBullet_Collision_test__ –> Finish I'll refer to classes whose names have been generated from the project's. Be careful if you want to use another name. If you don't have the AppWizard, just create a basic Ogre application that is able to create a window, fire up a FrameListener and deal with keyboard/mouse input handle. If you don't know how to do this, there's a [Basic Tutorial 6|tutorial] for it. From now on, I will refer to the AppWizard basic project. __Configuration__ Before we start coding (in the next tutorial) we need to do some configuration. Open the project's properties (Alt + F7) and do the following: - Go to Configuration Properties > C/C++ > General - Find __Additional Include Directories__, open with '...' button - Add __$(BULLET_HOME)\src__ to the list Do this for both __Debug__ and __Release__ modes (with the dropdown menu in the top-left corner of the window). - Now go to Configuration Properties > Linker > Input - Find __Additional Dependencies__ - Add the required elements. In the end it should contain these: __OgreMain_d.lib OIS_d.lib OgreBulletCollisions_d.lib OgreBulletDynamics_d.lib bulletcollision.lib bulletdynamics.lib LinearMath.lib GIMPACTutils.lib ConvexDecomposition.lib__ - Change the Configuration (in the top-left corner of the window) to __Release__ and insert these to the same place as before: __OgreMain.lib OIS.lib OgreBulletCollisions.lib OgreBulletDynamics.lib bulletcollision.lib bulletdynamics.lib LinearMath.lib GIMPACTutils.lib ConvexDecomposition.lib__ {BOX(title="The library names have changed.")} In the current SVN version of OgreBullet (rev2984) and Bullet version 2.78 (rev2387), the libraries names are different: <br /> <br /> __Release:__ OgreMain.lib OIS.lib OgreBullet__Col__.lib OgreBullet__Dyn__.lib __B__ullet__C__ollisio__n__.lib __B__ullet__D__ynamics.lib LinearMath.lib GIMPACT__U__tils.lib ConvexDecomposition.lib {BOX} Now close this window and go to Tools > Options > Projects and Solutions > VC++ Directories: - Set __Show directories__ for: __Include files__ - Put these paths in the list (including the path to OgreBullet): ....\OgreBullet\Collisions\include ....\OgreBullet\Dynamics\include - Change to __Library files__ and put these in the list: ....\OgreBullet\lib\Debug ....\OgreBullet\lib\Release Build the project. If all went well, you can now start the next tutorial which is based on this project :) __NOTE:__ Source code can be found at the end of the second tutorial. On to ((OgreBullet Tutorial 2))!