# single precision floats vs. double precision

Hello, I’m using an orthographic projection using glOrtho(). I have set up my transformation (eye, at, up) using gluLookAt(). Everything seems to work fine until I have very large coordinates ( > 10 million).

Even though I use glVertex3d(), and I specify double precision values, gl seems to be losing the precision. It’s as if gl is converting everything to single precision floating point values. Is this what gl does?

Is there any way to get gl to use double precision values?

Has anyone had experience using very large coordinate values with gl?

Hi !

As far as I know, most OpenGL hardware is using floats internally, and you cannot do anything about that… correct me if I am wrong.

Mikael

Why don’t you use offset.

Originally posted by Ryo:
Why don’t you use offset.

Say you have a point with following coordinates.
x : 10000000.111
y : 10000000.222
z : 10000000.333

Then, you can draw a point like this…

// Move by offset
glTranslated(10000000.0, 10000000.0, 10000000.0);

// Draw a point with value-offset
glBegin(GL_POINTS);
glVertex3f( 0.111f, 0.222f, 0.333f );
glEnd();

Hope it helps!

Originally posted by Ryo:
[b]Say you have a point with following coordinates.
x : 10000000.111
y : 10000000.222
z : 10000000.333

Then, you can draw a point like this…

// Move by offset
glTranslated(10000000.0, 10000000.0, 10000000.0);

// Draw a point with value-offset
glBegin(GL_POINTS);
glVertex3f( 0.111f, 0.222f, 0.333f );
glEnd();

Hope it helps![/b]

I dont’t think it will work.
Bcos the value of glTranslate is combined with what is passed to glVertex() and then it might exceed the largest possible float value, which is the same as passing it to glVertex directly.

Then, subtract a constance value from each point.