[Solved]Using precompiled libraries for physics

Problems building or running the engine, queries about how to use features etc.
Post Reply
hcl14
Kobold
Posts: 27
Joined: Mon Jan 26, 2015 8:27 pm
x 1

[Solved]Using precompiled libraries for physics

Post by hcl14 »

I spent two weeks and tried available physics libraries and their wrappers from here http://www.ogre3d.org/forums/viewtopic.php?f=8&t=63839, and I've got problems with building every wrapper. I tried to build ogrebullet, ogreNewton, ogreODE and finally PhysX SDK crashed my windows.
There are different problems with each wrapper, however physics libraries themselves compiled fine. So the question is - can I somehow get a precompiled version of physics, as external dll along with newton(for example) libs, without any headers and code. Just add them to my vc2010 project and use functions?

Please, can you help me to get it working, just a simple example?
Last edited by hcl14 on Mon Feb 16, 2015 1:42 am, edited 1 time in total.
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 138

Re: Using precompiled libraries for physics

Post by c6burns »

You need headers so that you know what symbols you will use from the library. If you didn't have the headers supplied by the library, you would have to create your own with the correct function prototypes.

I had an easy time starting with btOgre and using bullet directly:
https://github.com/nikki93/btogre

btOgre is very minimal, so most of the time you are using bullet directly. If you don't want to compile it as a separate library, you can dump it right into your project ... it's just 3 headers and 1 cpp (and zlib license means there is no issue doing that). Bullet motionstates make it easy to integrate with a renderer and work with the physics library directly.
hcl14
Kobold
Posts: 27
Joined: Mon Jan 26, 2015 8:27 pm
x 1

Re: Using precompiled libraries for physics

Post by hcl14 »

Thank you c6burns! I finally got it working! I will leave my settings here:

I have created an empty project with Ogre Tutorial settings:
http://www.ogre3d.org/tikiwiki/tiki-ind ... ual+Studio

Copied main.cpp, ExampleApplication.h, ExampleFrameListener.h, BtOgre.cpp into a separate folder and added includes and libs as follows(Debug configuration):

Include directories:
$(OGRE_HOME)\include
$(OGRE_HOME)\include\OIS
$(OGRE_HOME)\include\OGRE
$(OGRE_HOME)\include\OGRE\Overlay
$(OGRE_HOME)\include\OGRE\Terrain
$(OGRE_HOME)\Samples\Common\include
$(OGRE_HOME)\boost
$(OGRE_HOME)\boost\boost
C:\Users\hcl\Documents\baseapp\demo
C:\Users\hcl\Documents\baseapp\demo\exampleapp

C:\OgreSDK_vc10_v1-9-0\btogre-master ## btogre
C:\OgreSDK_vc10_v1-9-0\btogre-master\include
C:\OgreSDK_vc10_v1-9-0\bullet\src
## bullet

libraries:
OgreMain_d.lib
OIS_d.lib
OgreOverlay_d.lib
OgreTerrain_d.lib
C:\OgreSDK_vc10_v1-9-0\bullet\lib\BulletCollision_vs2010_debug.lib
C:\OgreSDK_vc10_v1-9-0\bullet\lib\BulletDynamics_vs2010_debug.lib
C:\OgreSDK_vc10_v1-9-0\bullet\lib\BulletSoftBody_vs2010_debug.lib
C:\OgreSDK_vc10_v1-9-0\bullet\lib\ConvexDecomposition_vs2010_debug.lib
# C:\OgreSDK_vc10_v1-9-0\bullet\lib\HACD_vs2010_debug.lib
<-- a lot of errors from msvcprtd.lib(MSVCP100D.dll) and libcpmtd.lib
C:\OgreSDK_vc10_v1-9-0\bullet\lib\LinearMath_vs2010_debug.lib
C:\OgreSDK_vc10_v1-9-0\bullet\lib\OpenGLSupport_vs2010_debug.lib
C:\OgreSDK_vc10_v1-9-0\bullet\Glut\glut32.lib
C:\OgreSDK_vc10_v1-9-0\bullet\Glut\glew32s.lib
C:\OgreSDK_vc10_v1-9-0\bullet\Extras\lib\BulletFileLoader_vs2010_debug.lib
C:\OgreSDK_vc10_v1-9-0\bullet\Extras\lib\BulletWorldImporter_vs2010_debug.lib
C:\OgreSDK_vc10_v1-9-0\bullet\Extras\lib\BulletXmlWorldImporter_vs2010_debug.lib



That's a debugger output:

Code: Select all

1>LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library

Code: Select all

1>------ Rebuild All started: Project: bullet_test, Configuration: Debug Win32 ------
1>  main.cpp
1>c:\ogresdk_vc10_v1-9-0\include\ogre\exampleframelistener.h(344): warning C4244: '+=' : conversion from 'double' to 'Ogre::Real', possible loss of data
1>c:\ogresdk_vc10_v1-9-0\include\ogre\exampleframelistener.h(345): warning C4244: '-=' : conversion from 'double' to 'Ogre::Real', possible loss of data
1>c:\ogresdk_vc10_v1-9-0\include\ogre\exampleframelistener.h(349): warning C4244: 'argument' : conversion from 'double' to 'Ogre::Real', possible loss of data
1>c:\ogresdk_vc10_v1-9-0\include\ogre\exampleframelistener.h(350): warning C4244: 'argument' : conversion from 'double' to 'Ogre::Real', possible loss of data
1>c:\ogresdk_vc10_v1-9-0\include\ogre\exampleframelistener.h(455): warning C4244: '-=' : conversion from 'double' to 'Ogre::Real', possible loss of data
1>c:\users\hcl\documents\baseapp\demo\main.cpp(99): warning C4305: 'argument' : truncation from 'double' to 'const btScalar'
1>c:\users\hcl\documents\baseapp\demo\main.cpp(130): warning C4305: 'argument' : truncation from 'double' to 'float'
1>c:\users\hcl\documents\baseapp\demo\main.cpp(130): warning C4305: 'argument' : truncation from 'double' to 'float'
1>c:\users\hcl\documents\baseapp\demo\main.cpp(130): warning C4305: 'argument' : truncation from 'double' to 'float'
1>c:\users\hcl\documents\baseapp\demo\main.cpp(133): warning C4305: 'argument' : truncation from 'double' to 'Ogre::Real'
1>  BtOgre.cpp
1>c:\users\hcl\documents\baseapp\demo\btogre.cpp(210): warning C4244: '=' : conversion from 'double' to 'Ogre::Real', possible loss of data
1>c:\users\hcl\documents\baseapp\demo\btogre.cpp(377): warning C4244: 'argument' : conversion from 'double' to 'btScalar', possible loss of data
1>c:\users\hcl\documents\baseapp\demo\btogre.cpp(377): warning C4244: 'argument' : conversion from 'double' to 'btScalar', possible loss of data
1>c:\users\hcl\documents\baseapp\demo\btogre.cpp(380): warning C4244: 'argument' : conversion from 'double' to 'btScalar', possible loss of data
1>c:\users\hcl\documents\baseapp\demo\btogre.cpp(380): warning C4244: 'argument' : conversion from 'double' to 'btScalar', possible loss of data
1>c:\users\hcl\documents\baseapp\demo\btogre.cpp(383): warning C4244: 'argument' : conversion from 'double' to 'btScalar', possible loss of data
1>c:\users\hcl\documents\baseapp\demo\btogre.cpp(383): warning C4244: 'argument' : conversion from 'double' to 'btScalar', possible loss of data
1>c:\users\hcl\documents\baseapp\demo\btogre.cpp(740): warning C4244: 'initializing' : conversion from 'double' to 'const Ogre::Real', possible loss of data
1>c:\users\hcl\documents\baseapp\demo\btogre.cpp(785): warning C4244: 'argument' : conversion from 'double' to 'const Ogre::Real', possible loss of data
1>c:\users\hcl\documents\baseapp\demo\btogre.cpp(786): warning C4244: 'argument' : conversion from 'double' to 'const Ogre::Real', possible loss of data
1>c:\users\hcl\documents\baseapp\demo\btogre.cpp(787): warning C4244: 'argument' : conversion from 'double' to 'const Ogre::Real', possible loss of data
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\utility(163): warning C4244: 'initializing' : conversion from 'unsigned short' to 'const unsigned char', possible loss of data
1>          c:\program files (x86)\microsoft visual studio 10.0\vc\include\utility(255) : see reference to function template instantiation 'std::_Pair_base<_Ty1,_Ty2>::_Pair_base<_Ty,std::vector<Ogre::Vector3>>(_Other1 &&,_Other2 &&)' being compiled
1>          with
1>          [
1>              _Ty1=const unsigned char,
1>              _Ty2=std::vector<Ogre::Vector3> *,
1>              _Ty=unsigned short,
1>              _Other1=unsigned short,
1>              _Other2=BtOgre::Vector3Array *
1>          ]
1>          c:\program files (x86)\microsoft visual studio 10.0\vc\include\xmemory(208) : see reference to function template instantiation 'std::pair<_Ty1,_Ty2>::pair<unsigned short,BtOgre::Vector3Array*>(std::pair<unsigned short,_Ty2> &&)' being compiled
1>          with
1>          [
1>              _Ty1=const unsigned char,
1>              _Ty2=std::vector<Ogre::Vector3> *
1>          ]
1>          c:\program files (x86)\microsoft visual studio 10.0\vc\include\xmemory(280) : see reference to function template instantiation 'void std::allocator<_Ty>::construct<std::pair<_Ty1,_Ty2>>(std::pair<const _Kty,_Ty2> ,_Other &&)' being compiled
1>          with
1>          [
1>              _Ty=std::pair<const unsigned char,std::vector<Ogre::Vector3> *>,
1>              _Ty1=unsigned short,
1>              _Ty2=BtOgre::Vector3Array *,
1>              _Kty=unsigned char,
1>              _Other=std::pair<unsigned short,BtOgre::Vector3Array *>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(592) : see reference to function template instantiation 'void std::_Cons_val<std::allocator<_Ty>,_Ty,std::pair<_Ty1,_Ty2>>(_Alloc &,std::pair<const _Kty,_Ty2> *,std::pair<_Ty1,_Ty2> &&)' being compiled
1>          with
1>          [
1>              _Ty=std::pair<const unsigned char,std::vector<Ogre::Vector3> *>,
1>              _Ty1=unsigned short,
1>              _Ty2=BtOgre::Vector3Array *,
1>              _Alloc=std::allocator<std::pair<const unsigned char,std::vector<Ogre::Vector3> *>>,
1>              _Kty=unsigned char
1>          ]
1>          c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(755) : see reference to function template instantiation 'std::_Tree_nod<_Traits>::_Node *std::_Tree_val<_Traits>::_Buynode<_Ty>(_Valty &&)' being compiled
1>          with
1>          [
1>              _Traits=std::_Tmap_traits<unsigned char,std::vector<Ogre::Vector3> *,std::less<Ogre::uint8>,std::allocator<std::pair<const unsigned char,std::vector<Ogre::Vector3> *>>,false>,
1>              _Ty=std::pair<unsigned short,BtOgre::Vector3Array *>,
1>              _Valty=std::pair<unsigned short,BtOgre::Vector3Array *>
1>          ]
1>          c:\users\hcl\documents\baseapp\demo\btogre.cpp(147) : see reference to function template instantiation 'std::pair<_Ty1,_Ty2> std::_Tree<_Traits>::insert<std::pair<unsigned short,BtOgre::Vector3Array *>>(_Valty &&)' being compiled
1>          with
1>          [
1>              _Ty1=std::_Tree_iterator<std::_Tree_val<std::_Tmap_traits<unsigned char,std::vector<Ogre::Vector3> *,std::less<Ogre::uint8>,std::allocator<std::pair<const unsigned char,std::vector<Ogre::Vector3> *>>,false>>>,
1>              _Ty2=bool,
1>              _Traits=std::_Tmap_traits<unsigned char,std::vector<Ogre::Vector3> *,std::less<Ogre::uint8>,std::allocator<std::pair<const unsigned char,std::vector<Ogre::Vector3> *>>,false>,
1>              _Valty=std::pair<unsigned short,BtOgre::Vector3Array *>
1>          ]
1>  Generating Code...
1>  bullet_test.vcxproj -> C:\Users\hcl\Documents\Visual Studio 2010\Projects\bullet_test\Debug\bullet_test.exe
1>          1 file(s) copied.
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
Attachments
screenshot
screenshot
Post Reply