# What are valid ranges of space dimensions used in OpenGL?

I want to know what the valid ranges of all the spaces in OpenGL are.

Specifically:
Maximum and Minimum Clip space X, Y, and Z (gl_Position)
Maximum and Minimum gl_FragCoord X, Y, and Z
Maximum and Minimum gl_FragDepth value

• Since OpenGL operates with floats and doubles, your best bet is to have your virtual world to always be roughly around the same scale (x1 .. x10^5). Otherwise you will see some rounding errors. Depth and other buffers are best to operate within 0..1 scale iirc. – Kromster says support Monica May 14 '18 at 4:39
• This reminds me of World Racing game. In later versions the team started to use XL sceneries, up to 10km long. That lead to some glitches on car pieces anchoring, when a piece got attached to another piece to a car it would jitter for fractions of a pixel (revealing black underneaths) because of car being 10^5 meters away from worlds origin and car pieces being rigged with some 10^-4 precision. Single-precision floats could not handle summing that up well. Lesson - keep viewport contents in roughly the same scale and account for precision loss when working with floats. Then you will be fine. – Kromster says support Monica May 14 '18 at 9:19

There's no real limit to any of these. Of course floats have maximum values (I think around 10^308), but if you have problems with that, then reconsider what you're doing.

If the depth falls out of the specified range by glDepthRange (or [0,1] by default), then it will get clipped due to depth buffer issues, but it can have any value.