Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Numerical stability

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2006
    Location
    Meudon / France
    Posts
    1

    Numerical stability

    Bonjour,

    I have a numerical stability problem.
    A small test app draws a textured rectangle of unit length (1.0) . This rectangle is seen from a distance of some units (3.0) and the "camera" is smoothly moved around this point (by steps of 0.001).

    It works perfectly well.

    But when I translate everything to 1.0e6 units away from 0.0, the movement becomes jitterred.

    On my machine (Pentium/Windows, hardwared OpenGL), (1.0e6+1.0e-3)+1.0e-3 perfectly equals 1000000.002 when using GLdouble (but precision is lost when using GLfloat).

    Will I have to do the world space translation outside of OpenGL, possibly using some "bignums" of my own, or is there any trick inside OpenGL for that ?

    NB: views are set using GLU or by hand (setting both MODELVIEW and PROJECTION matrixes), results are the same.

    --
    Thierry Bernier

  2. #2
    Intern Contributor
    Join Date
    Feb 2004
    Location
    Dallas/ Nottingham
    Posts
    96

    Re: Numerical stability

    Your running in the standard real number precision issues whether float of double

    Doubles really don't help too much as Opengl converts them to floats any way

    And don't forget the golden rule you never compare real numbers on a computer ( float or doubles ) always test for in equality

    There any many many ways to try and reduce the issue with number precision using pengl a search of these forums may help or a straight Google may help

    And you have no guarantee on any PC the any real number will perfectly equal a give value

    But you are going to have to handle the problem, Opengl itself does not offer you any tools to directly help with the precision issues

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •