units of length in opengl

in opengl, if i draw a line from (0,0) to (2,0),
it will be a line of 2 units of length . wil it be equivalent to 2mm or 2" or what exactly?

It will be as long as you choose it to be.

OpenGL doesn’t have units. Units are a concept layered on top of OpenGL based on your projection and camera matrices.

More specifically, all length is relative. Because OpenGL (and all other renderers) are based on an entirely virtual world, there is no thing relative to base it on. So, what an “inch” is really only matters relative to something that a human can recognize.

Good point!

Just a tip: If you are used to work with the metric system, just choose 1 OpenGL unit to be 1 meter. Of course this is completely up to you, but it makes life very easy to use this scaling, because all physical formulas use meters and seconds as their basic unit, and therefore it is easy to just copy and paste such stuff, if you use the same scaling.

But if you are used to the american system, you can work with that, of course.

Jan.