I want to display models of different sizes fitted into a view, so that the whole model is visible inside the screen.
What is the best way to do it?
I tried scaling (using glScale) the model using this formula
scaleFactor = ( screenSize / (maxModelSize * constant) )
Where size is height or width, depending on what is bigger.
Constant is 1 / (length of one screen pixel in OpenGL units)
There are two problems with this:
1. After doing some transformations, I want to be able to return to this initial scale (model is scaled to fit window) using Identity. Currently calling identity will bring the model to its original dimensions (before the "fixing" scale).
2. The "constant" is something I got by trial and error, I feels wrong method to me. I also suspect that it is not a constant at all, and depends on screen resolution and god knows what else.
Section 8.070: