How to fit an Object in a window ???


i want to display a 3D object to fit in a window.I know the co-ordinate of all the object.But when i displayed the object is smaller.How i can zoom the object initally to fit the window ?.How it possible…?


You can either scale Your object with
glScale() to fit the window or You change the size of Your coordinate system. That means You’ll have to call glOrtho() or manipulate the matrix in any other way.
The default window coordinates are allways
(-1,-1) to (1,1).
With this code below You transform Your window coordinates to exactly the pixel size of it …

glViewport(0, 0, WinWidth, WinHeight);

glOrtho(0, WinWidth, 0, WinHeight, -z, z);