Laubstein
07-01-2013 13:51:34
Hi! It is gonna be a newbie tutorial for all the people lost which are trying to build OgreBullet.
This tutorial will use the following libraries on Windows.
PS: I will assume you already has the OgreSDK in your system.
First of all we will need to access the trunk source of OgreBullet so I suggest you to download Tortoise at: http://tortoisesvn.net/downloads.html
Install it. Now you can access some tortoise's functions clicking with the mouse's right button on Internet Explorer window.
Create a folder named OgreBullet, inside the folder right click and choose "SVN checkout". In the field "URL repository" put: https://ogreaddons.svn.sourceforge.net/ ... ogrebullet and click "Ok". While downloading you can go to pee.
Now we will need to download the Bullet source at: http://code.google.com/p/bullet/downloa ... ev2613.zip
Extract it in a folder named Bullet :p
Now we will download a nice tool to help us set up Bullet to be build and its name is CMAKE. Download it at: http://www.cmake.org/files/v2.8/cmake-2 ... 32-x86.exe
Install it.
Now let's create an enviroment variables. What is an enviroment variable: http://www.itechtalk.com/thread3595.html
Name: BULLET_ROOT
Value: the path you extracted Bullet.
Now Let's launch CMAKE i guess the installer has created a shortcut in the desktop.
At the CMAKE window in "Where is the source code"
put: D:/Bullet/bullet-2.81-rev2613 <- It is the path where my Bullet's folder is, so change it to fit yours.
In the field "Where to build binaries"
put D:\Bullet\bullet-2.81-rev2613\build\cmakebuild <- change the path again. If the folder "cmakebuild" does not exists just create it.
Close all instances of Visual Studio and click on the "Configure" button. In the next window in "Specify the generator for this project" choose the version of your Visual Studio and click "Finish"
A lot of parameters will appears, search for "USE_MSVC_RUNTIME_LIBRARY_DLL and check it (it is very important).
Now click "Generate" and pray.
Now open the solution at D:\Bullet\bullet-2.81-rev2613\build\cmakebuild\BULLET_PHYSICS.sln
Build the release and debug: http://msdn.microsoft.com/en-us/library/wx0123s5.aspx
Everything must build fine.
Now open the solution at D:\OgreBullet\OgreBullet_VC8.sln
Right click in the Dynamics_Demos
in Additional Include Directories leave as:
$(BULLET_ROOT)\src
$(BULLET_ROOT)\Extras\ConvexDecomposition
..\..\include
..\..\..\include
..\..\..\..\Collisions\include
..\..\..\..\Dynamics\include
$(OGRE_HOME)\include\Ogre
$(OGRE_HOME)\boost
$(OGRE_HOME)\include
$(OGRE_HOME)\include\OIS
In Linker -> Additional library directories leave as:
..\..\..\..\lib\$(Configuration)
$(OGRE_HOME)\lib\$(Configuration)
$(OGRE_HOME)\boost\lib
$(BULLET_ROOT)\lib
In Linker -> Input:
OgreMain.lib
ois.lib
OgreBulletCollisions.lib
OgreBulletDynamics.lib
BulletCollision.lib
BulletDynamics.lib
LinearMath.lib
ConvexDecomposition.lib
Ps: In debug mode change OgreMain.lib to OgreMain_d.lib, ois.lib to ois_d.lib and append _debug.lib in the remainder.
Apply the changes:
Now let's configure the OgreBulletCollisions. Additional Include Directories leave as:
..\..\include
$(BULLET_ROOT)\src
$(BULLET_ROOT)\Extras\ConvexDecomposition
$(OGRE_HOME)\include
$(OGRE_HOME)\include\Ogre
$(OGRE_HOME)\boost
Now let's configure the OgreBulletDynamics. Additional Include Directories leave as:
..\..\include
..\..\..\Collisions\include
$(BULLET_ROOT)\src
$(OGRE_HOME)\include
$(OGRE_HOME)\include\Ogre
$(OGRE_HOME)\boost
Apply the changes:
Now open the OgreBulletDynamicsWorld.cpp and change the line:
to
Now in OgreBulletCollisionsRay.cpp change the line:
to:
Now in OgreBulletCollisionsWorld.cpp change the line:
to:
Finally We are able to build in release and debug mode.
Now you are able to use the static libs to link into your projects. To test the OgreBulletDemo copy the "OgreBulletDynamicsDemo.exe" in
D:\OgreBullet\Demos to your OgreSDK/bin/release.
Open the resource.cfg and add the following lines:
[Bootstrap]
Zip=D:/OgreBullet/Demos/Media/packs/OgreCore.zip
# Resource locations to be added to the default path
[General]
......
FileSystem=D:/OgreBullet/Demos/Media
FileSystem=D:/OgreBullet/Demos/Media/fonts
FileSystem=D:/OgreBullet/Demos/Media/materials/programs
FileSystem=D:/OgreBullet/Demos/Media/materials/scripts
FileSystem=D:/OgreBullet/Demos/Media/materials/textures
FileSystem=D:/OgreBullet/Demos/Media/models
FileSystem=D:/OgreBullet/Demos/Media/overlays
FileSystem=D:/OgreBullet/Demos/Media/particle
FileSystem=D:/OgreBullet/Demos/Media/gui
[Bullet]
FileSystem=D:/OgreBullet/Demos/Media/OgreBullet
FileSystem=D:/OgreBullet/Demos/Media/materials
FileSystem=D:/OgreBullet/Demos/Media/textures
PS: Remember to change the "D:/OgreBullet/Demos" path to fit yours.
Now click in OgreBulletDynamicsDemo.exe and it is done!
This tutorial will use the following libraries on Windows.
- OgreSDK 1.8.1
Bullet 2.8.1
OgreBullet from Trunk <- Since we are using the latest release, things can change in the future.
PS: I will assume you already has the OgreSDK in your system.
First of all we will need to access the trunk source of OgreBullet so I suggest you to download Tortoise at: http://tortoisesvn.net/downloads.html
Install it. Now you can access some tortoise's functions clicking with the mouse's right button on Internet Explorer window.
Create a folder named OgreBullet, inside the folder right click and choose "SVN checkout". In the field "URL repository" put: https://ogreaddons.svn.sourceforge.net/ ... ogrebullet and click "Ok". While downloading you can go to pee.
Now we will need to download the Bullet source at: http://code.google.com/p/bullet/downloa ... ev2613.zip
Extract it in a folder named Bullet :p
Now we will download a nice tool to help us set up Bullet to be build and its name is CMAKE. Download it at: http://www.cmake.org/files/v2.8/cmake-2 ... 32-x86.exe
Install it.
Now let's create an enviroment variables. What is an enviroment variable: http://www.itechtalk.com/thread3595.html
Name: BULLET_ROOT
Value: the path you extracted Bullet.
Now Let's launch CMAKE i guess the installer has created a shortcut in the desktop.
At the CMAKE window in "Where is the source code"
put: D:/Bullet/bullet-2.81-rev2613 <- It is the path where my Bullet's folder is, so change it to fit yours.
In the field "Where to build binaries"
put D:\Bullet\bullet-2.81-rev2613\build\cmakebuild <- change the path again. If the folder "cmakebuild" does not exists just create it.
Close all instances of Visual Studio and click on the "Configure" button. In the next window in "Specify the generator for this project" choose the version of your Visual Studio and click "Finish"
A lot of parameters will appears, search for "USE_MSVC_RUNTIME_LIBRARY_DLL and check it (it is very important).
Now click "Generate" and pray.
Now open the solution at D:\Bullet\bullet-2.81-rev2613\build\cmakebuild\BULLET_PHYSICS.sln
Build the release and debug: http://msdn.microsoft.com/en-us/library/wx0123s5.aspx
Everything must build fine.
Now open the solution at D:\OgreBullet\OgreBullet_VC8.sln
Right click in the Dynamics_Demos
in Additional Include Directories leave as:
$(BULLET_ROOT)\src
$(BULLET_ROOT)\Extras\ConvexDecomposition
..\..\include
..\..\..\include
..\..\..\..\Collisions\include
..\..\..\..\Dynamics\include
$(OGRE_HOME)\include\Ogre
$(OGRE_HOME)\boost
$(OGRE_HOME)\include
$(OGRE_HOME)\include\OIS
In Linker -> Additional library directories leave as:
..\..\..\..\lib\$(Configuration)
$(OGRE_HOME)\lib\$(Configuration)
$(OGRE_HOME)\boost\lib
$(BULLET_ROOT)\lib
In Linker -> Input:
OgreMain.lib
ois.lib
OgreBulletCollisions.lib
OgreBulletDynamics.lib
BulletCollision.lib
BulletDynamics.lib
LinearMath.lib
ConvexDecomposition.lib
Ps: In debug mode change OgreMain.lib to OgreMain_d.lib, ois.lib to ois_d.lib and append _debug.lib in the remainder.
Apply the changes:
Now let's configure the OgreBulletCollisions. Additional Include Directories leave as:
..\..\include
$(BULLET_ROOT)\src
$(BULLET_ROOT)\Extras\ConvexDecomposition
$(OGRE_HOME)\include
$(OGRE_HOME)\include\Ogre
$(OGRE_HOME)\boost
Now let's configure the OgreBulletDynamics. Additional Include Directories leave as:
..\..\include
..\..\..\Collisions\include
$(BULLET_ROOT)\src
$(OGRE_HOME)\include
$(OGRE_HOME)\include\Ogre
$(OGRE_HOME)\boost
Apply the changes:
Now open the OgreBulletDynamicsWorld.cpp and change the line:
btCollisionObject* obA = static_cast<btCollisionObject*>(contactManifold->getBody0()); // For older Bullet versions (original code)
btCollisionObject* obB = static_cast<btCollisionObject*>(contactManifold->getBody1()); // For older Bullet versions (original code)
to
#if BT_BULLET_VERSION>=281
btCollisionObject* obA = const_cast<btCollisionObject*>(contactManifold->getBody0());; // For newer Bullet versions
btCollisionObject* obB = const_cast<btCollisionObject*>(contactManifold->getBody1()); // For newer Bullet versions
#else
btCollisionObject* obA = static_cast<btCollisionObject*>(contactManifold->getBody0()); // For older Bullet versions (original code)
btCollisionObject* obB = static_cast<btCollisionObject*>(contactManifold->getBody1()); // For older Bullet versions (original code)
#endif
Now in OgreBulletCollisionsRay.cpp change the line:
return mWorld->findObject(static_cast<btCollisionWorld::ClosestRayResultCallback *> (mRayResultCallback)->m_collisionObject);
to:
#if BT_BULLET_VERSION>=281
return mWorld->findObject(const_cast<btCollisionObject*>(static_cast<btCollisionWorld::ClosestRayResultCallback *> (mRayResultCallback)->m_collisionObject));
#else
return mWorld->findObject(static_cast<btCollisionWorld::ClosestRayResultCallback *> (mRayResultCallback)->m_collisionObject);
#endif
Now in OgreBulletCollisionsWorld.cpp change the line:
btCollisionObject* obA = static_cast<btCollisionObject*>(contactManifold->getBody0());
btCollisionObject* obB = static_cast<btCollisionObject*>(contactManifold->getBody1());
to:
btCollisionObject* obA = const_cast<btCollisionObject*>(contactManifold->getBody0());
btCollisionObject* obB = const_cast<btCollisionObject*>(contactManifold->getBody1());
Finally We are able to build in release and debug mode.
Now you are able to use the static libs to link into your projects. To test the OgreBulletDemo copy the "OgreBulletDynamicsDemo.exe" in
D:\OgreBullet\Demos to your OgreSDK/bin/release.
Open the resource.cfg and add the following lines:
[Bootstrap]
Zip=D:/OgreBullet/Demos/Media/packs/OgreCore.zip
# Resource locations to be added to the default path
[General]
......
FileSystem=D:/OgreBullet/Demos/Media
FileSystem=D:/OgreBullet/Demos/Media/fonts
FileSystem=D:/OgreBullet/Demos/Media/materials/programs
FileSystem=D:/OgreBullet/Demos/Media/materials/scripts
FileSystem=D:/OgreBullet/Demos/Media/materials/textures
FileSystem=D:/OgreBullet/Demos/Media/models
FileSystem=D:/OgreBullet/Demos/Media/overlays
FileSystem=D:/OgreBullet/Demos/Media/particle
FileSystem=D:/OgreBullet/Demos/Media/gui
[Bullet]
FileSystem=D:/OgreBullet/Demos/Media/OgreBullet
FileSystem=D:/OgreBullet/Demos/Media/materials
FileSystem=D:/OgreBullet/Demos/Media/textures
PS: Remember to change the "D:/OgreBullet/Demos" path to fit yours.
Now click in OgreBulletDynamicsDemo.exe and it is done!