Double precision won't compile from 2.75 onwards

diamond.geezer
Posts: 7
Joined: Tue Jan 26, 2010 1:49 pm

Double precision won't compile from 2.75 onwards

Post by diamond.geezer »

Double precision won't compile from 2.75 onwards

Hi,

It seems that Bullet libraries don't compile in double precision (set by adding #define BT_USE_DOUBLE_PRECISION at top of btScalar.h)

Have tried the 2.75 release, the trunk release (Dec 09) and the current SVN latest.
I'm running 64bit Ubuntu 9.10 , gcc 4.4.1, make 3.81, cmake 2.6 patch 4

I use "cmake ." , then "make"

It compiles OK if I don't use the flag (i.e. single precision)

Have tried doing "export CPPFLAGS=-DBT_USE_DOUBLE_PRECISION" before running make.
This compiles, but the AppDoublePrecisionDemo reports single precision, so I'm assuming this flag is simply ignored.

Compile Errors:

Code: Select all

... ./bullet-trunk/src/BulletDynamics/Dynamics/Bullet-C-API.cpp: In function ‘void plSetOpenGLMatrix(plRigidBodyHandle__*, plReal*)’:
... ./bullet-trunk/src/BulletDynamics/Dynamics/Bullet-C-API.cpp:303: error: no matching function for call to ‘btTransform::setFromOpenGLMatrix(plReal*&)’
... ./bullet-trunk/src/LinearMath/btTransform.h:126: note: candidates are: void btTransform::setFromOpenGLMatrix(const btScalar*)
... ./bullet-trunk/src/BulletDynamics/Dynamics/Bullet-C-API.cpp: In function ‘void plGetOpenGLMatrix(plRigidBodyHandle__*, plReal*)’:
... ./bullet-trunk/src/BulletDynamics/Dynamics/Bullet-C-API.cpp:310: error: no matching function for call to ‘btTransform::getOpenGLMatrix(plReal*&)’
... ./bullet-trunk/src/LinearMath/btTransform.h:134: note: candidates are: void btTransform::getOpenGLMatrix(btScalar*) const
make[2]: *** [src/BulletDynamics/CMakeFiles/BulletDynamics.dir/Dynamics/Bullet-C-API.o] Error 1
Any help / fixes much appreciated
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Double precision won't compile from 2.75 onwards

Post by Erwin Coumans »

Double precision builds work just fine for all versions, including Bullet 2.75 and latest trunk, just use the right cmake flags.

Latest svn trunk has an option you can use to make it easier. CPPFLAGS don't work for the file you have errors, because it is a c file.
In the root CMakeLists.txt there is now this:

Code: Select all

OPTION(USE_DOUBLE_PRECISION "Use double precision"	OFF)

IF (USE_DOUBLE_PRECISION)
ADD_DEFINITIONS( -DBT_USE_DOUBLE_PRECISION)
ENDIF (USE_DOUBLE_PRECISION)

Thanks,
Erwin
diamond.geezer
Posts: 7
Joined: Tue Jan 26, 2010 1:49 pm

Re: Double precision won't compile from 2.75 onwards

Post by diamond.geezer »

OK, brilliant, that worked for 2.75. Thanks.
mzoline
Posts: 1
Joined: Mon Feb 22, 2010 7:12 pm

Re: Double precision won't compile from 2.75 onwards

Post by mzoline »

Hello,
I'm trying to get rid of tons of: "conversion from 'btScalar' to 'float', possible loss of data" warnings while building Bullet 2.76 with MSVC
Any suggestions?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Double precision won't compile from 2.75 onwards

Post by Erwin Coumans »

mzoline wrote:Hello,
I'm trying to get rid of tons of: "conversion from 'btScalar' to 'float', possible loss of data" warnings while building Bullet 2.76 with MSVC
Any suggestions?
Those warnings only appear when using double precision mode right?

We currently only make attempts to remove warnings in Bullet in single precision mode. If someone has a minimal patch for those warnings, we will apply it (don't fix any other issues in the same patch).
Thanks,
Erwin
DIMEDROLL
Posts: 5
Joined: Fri May 21, 2010 12:11 pm

Re: Double precision won't compile from 2.75 onwards

Post by DIMEDROLL »

To compile with double precision in MSVC2008 I also added

Code: Select all

#define BT_USE_DOUBLE_PRECISION

at top of btScalar.h(as Bullet_User_Manual.pdf says) and received some errors while compiling.
I tried to add BT_USE_DOUBLE_PRECISION in Preprocessor Definitions property page for each project BulletCollision, BulletDynamics... etc. And there are no compilation errors. Is there any other\simpler way I can turn double precision on?
I've already made a separate configuration for this(DebugDoublePrecision)