View Full Version : Quick Question about Views
02-19-2007, 05:15 AM
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.
02-19-2007, 05:27 AM
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.
02-19-2007, 06:08 AM
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.
02-20-2007, 04:14 AM
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!
02-20-2007, 05:42 AM
Thank you thinks. I will check it out.
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.