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