Results 1 to 4 of 4

Thread: Accuracy at large translations

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2011
    Location
    California, U.S.
    Posts
    19

    Accuracy at large translations

    I don't understand why when I translate something very far (like to an X of 100,000) the object being drawn snaps around while moving instead of being smooth. I figured it was because I was using floats (only had a couple decimal points of precision at that distance), but when I started using glTranslated the result was the same.

    The object being drawn has vertices defined by floats, but I figure that shouldn't matter because the object itself is very small. Does gltranslate add an offset to all of the vertices or something? If that's true, then making the object use double precision vertices should fix the problem right?

  2. #2
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,674

    Re: Accuracy at large translations

    I figured it was because I was using floats (only had a couple decimal points of precision at that distance), but when I started using glTranslated the result was the same.
    I wouldn't expect the "double` versions of the matrix functions to actually use doubles internally. They probably just cast them to floats.

    You need to use doubles to generate your ModelView matrix manually (ie: not with OpenGL functions), then convert that matrix back to floats when you hand it to OpenGL (via glLoadMatrix). That way, your large translation from model-to-world will cancel out with your equally large but negative world-to-camera translation.

  3. #3
    Senior Member Regular Contributor
    Join Date
    Apr 2007
    Posts
    268

    Re: Accuracy at large translations

    read the "Floating point precision and accuracy" section here:

    http://www.opensg.org/wiki/HDI/HugeScenes

    www.floatingorigin.com/pubs/thorneC-FloatingOrigin.pdf

    As well as this detailed blog post:

    http://blogs.agi.com/insight3d/index...ns-precisions/

  4. #4
    Junior Member Newbie
    Join Date
    Apr 2011
    Location
    California, U.S.
    Posts
    19

    Re: Accuracy at large translations

    @Alfonse: Thanks, that did the trick!
    @Overaly: Also thanks, I'll check those out.

Similar Threads

  1. Model Translations
    By Richard145 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 03-15-2007, 07:04 AM
  2. Translations within one batch
    By holdeWaldfee in forum OpenGL: Advanced Coding
    Replies: 54
    Last Post: 07-17-2006, 03:39 PM
  3. translations
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 11-03-2003, 12:16 AM
  4. Translations and rotations?!
    By esuvs in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 02-18-2003, 06:10 PM
  5. Help me, translations don't work !!
    By airseb in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-12-2002, 09:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean