Laurent Crivello
Laurent Crivello

Reputation: 3931

Precision/units in OpenGL

I am currently developing in OpenGL and use the meter as my own unit, i.e. 0.2 for a 20 cm wide triangle. However OpenGL seems to round these figures, which ends in shapes not exactly following my wishes. Is this normal in OpenGL, and should I use centimeters as the unit instead?

Upvotes: 2

Views: 307

Answers (2)

mlepage
mlepage

Reputation: 2472

OpenGL units are simply units, measures of some unspecified thing. They can mean whatever you want. Unless you are getting incredibly small, large, or precise, it won't make a practical difference. 0.2 should be fine.

Upvotes: 1

jondinham
jondinham

Reputation: 8499

You seem to use 1m for 1 unit in GL space, the shape distortion might be caused the incorrect perspective, either too much twisted or flattened, or higher than usual. This is because of incorrect viewport ratio, etc.

OpenGL never rounds up anything, only the precision limit of float or double types.

If you are using OpenGL for architecture, I suggest considering 1 GL unit as 1mm.

Upvotes: 4

Related Questions