PDA

View Full Version : Zoom Fit



Steilen
08-01-2001, 05:03 AM
Hi All !!!

I'm developping an interface app with some openGL graphics in it : in fact, I am drawing points (the coordinates of which come from another dialogbox) on the window...
Unfortunately the coordinate system in which those points are set is not known to me... So I've placed a gluLookAt() call with arguments not really accurate.(so that sometimes my points are not on the screen!!)
What I would like to know is if it is possible to find some automated transformations in order to zoom fit my points to the window (so as to see them all)...

Thanks for all hints or answers!!

RedZen
08-01-2001, 05:26 AM
Tried scaling?
Or you can just work out a routine to move the cam further away, untill everything is on screen... Dunno if thats what you mean...

[This message has been edited by RedZen (edited 08-01-2001).]

Pat
08-01-2001, 09:22 AM
You could try finding the min and max values of the points that you are trying to view to create a "bounding box" in 3D. Then use the glOrtho command to set up the projection matrix and use gluLookAt to set your viewing transformation to "look at" the center of the bounding box.

[This message has been edited by Pat (edited 08-01-2001).]