PDA

View Full Version : World coordinate problem



Lanstorp
08-20-2002, 12:50 PM
I have some world coordinates (~11000 points)like:
(x,y,z)=(533900.0,6178625.0,65.9)
(x,y,z)=(533925.0,6178625.0,74.9)
(x,y,z)=(533950.0,6178625.0,83.9)
All coordinates fall with in a box with dimensions 2km x 3km x 100m. I am used to work in the area around (0,0,0) and can not get the points visible on screen. Keep getting a black screen. Any source or pseudocode to guide me om this problem is very welcome http://www.opengl.org/discussion_boards/ubb/smile.gif

Jeeeez
08-20-2002, 01:59 PM
Did you make your viewport big enough?

jwatte
08-20-2002, 07:18 PM
Passing large values to GL is bad, because GL often works internally in floating-point precision, and thus suffers horrible truncation problems with large values in the transform matrices.

Pick a center. Say, 533900.0,6178625.0,65.9 (or just calculate the average of all the vertices). Then subtract this value from each of your double-precision vertices on load, and store them in single precision floats in your vertex array.

Lanstorp
08-20-2002, 10:14 PM
The subtraction and some scaleing really did clear the problem with the coordinate size, thanx http://www.opengl.org/discussion_boards/ubb/wink.gif