double precision

Get answers to all your basic programming questions. No Ogre questions, please!
neveu
Gnoblar
Posts: 1
Joined: Tue Apr 12, 2005 1:12 am

double precision

Post by neveu »

Quick newbie question: does OGRE have (or is it possible for OGRE to have) double precision position information in a scenegraph?
User avatar
Robomaniac
Hobgoblin
Posts: 508
Joined: Tue Feb 03, 2004 6:39 am

Post by Robomaniac »

yup, just change the typdef of Ogre::Real to double and it should work
phear hingo

My Webpage
User avatar
IoN_PuLse
Goblin
Posts: 220
Joined: Mon May 31, 2004 5:54 am
Location: Canada

Post by IoN_PuLse »

Although DirectX and OpenGL as far as I know only work in single precision, so I'm not sure if there is any point :)
User avatar
:wumpus:
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3067
Joined: Tue Feb 10, 2004 12:53 pm
Location: The Netherlands
x 1

Post by :wumpus: »

Yes, it's possible, and it's only a bit slower. And yeah, OpenGL and DX still only get the values in single precision but that shouldn't matter for rendering anyway. The scenegraph can be in double precision.
Van
Hobgoblin
Posts: 512
Joined: Fri Nov 19, 2004 3:56 am

Post by Van »

We use double precision in our application. The frame hit was very minimal (like two tp five fps) - not even noticeable.

You have to change a #define flag in your OgreConfig.h file and recompile the Ogre library. Word of caution though, if you plan on using any other libraries make sure they support doubles and some of the ogreaddons require lots of modifications to support double. For some reason some of those authors used a float declaration instead of using Ogre::Real.

BTW, we also use the Newton Physics engine which also supports a double precision. Newton here: http://www.physicsengine.com
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66

Post by sinbad »

Robomaniac wrote:yup, just change the typdef of Ogre::Real to double and it should work
No, don't do that. The correct way to do this is to change OGRE_DOUBLE_PRECISION in OgreConfig.h to 1.
User avatar
DFooz
Gnoblar
Posts: 9
Joined: Mon Oct 29, 2012 3:03 pm
Location: Russia, Moscow

Re: double precision

Post by DFooz »

1) Is Ogre SDK builded in single precision?
2)If yes, how can I set double precision without recompiling?
Just set in OgreConfig.h, isn't it:

Code: Select all

#ifndef OGRE_DOUBLE_PRECISION
#define OGRE_DOUBLE_PRECISION 1
#endif
Thank you.
bstone
OGRE Expert User
OGRE Expert User
Posts: 1920
Joined: Sun Feb 19, 2012 9:24 pm
Location: Russia
x 201

Re: double precision

Post by bstone »

You have to recompile it.
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 136

Re: double precision

Post by spacegaier »

And you can also set that pre-compilation macro via CMake I think.
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...