reshaping a window in perspective view

i am using the following code to handle reshaping in window view:

if(h == 0)
		h = 1;

	float ratio = 1.0* (float)w / (float)h;
// Reset the coordinate system before modifying
		// Set the viewport to be the entire window
		glViewport(0, 0, w, h);

		// Set the correct perspective.
		gluPerspective(90, ratio, 1, 30);

This works to keep the right proportion on the objects that i am displaying, but when the window is really skinny and tall, parts of the objects are clipped out of the picture. Any idea why this could be happening?

If the viewport is very thin some objects will be clipped because they can’t fit in the viewport, if you want to keep the aspect ratio there is nothing you can do about that, but if you don’t set the aspect ratio to w/h and use 1 instead the objects will be visible even with very thin viewport, but they will of course look like ****.