Quick Question about Views

This may be a stupid question, but is there a way to ensure that a given model is initially displayed at a certain percentage of the current view? I would like the model to initially show as 50% of the current viewport.

Thanks in advance.

if it is ok to use an ortho view, i would suggest:

  1. find the model center
  2. find the maximum distance r_max of all vertices to that center point. thus you get a sphere which fits the model.
  3. use gluLookAt in a way that you look at the center point
  4. use glOrtho(-r_max, r_max, -r_max, rmax, near, far). the viewing volume then is twice as big as the sphere.

Thanks for the fast reply, RigidBody. The program needs to use both Ortho and perspective - but the info you gave is a good idea.

I have different question though, what is the easiest way to “move” a rendered object using a mouse?

Once again, thank you.

I saw something like this implemented for perspective and ortho a while ago. Google for “bounding sphere” and synonyms to that. It is a solvable problem!

Thank you thinks. I will check it out.