View Full Version : Lost perspective
09-14-2001, 01:06 AM
i'm trying to upgrade an existing program, written by someone else.
the problem is that i'd like to change the shape of a window (basically widen it a bit, but keep the objects in the same aspect ratio).
unfortunately, this has stretched the whole image, and i've no idea how to sort it.
In most cases people use gluPerspective to setup a projection matrix. If you do aswell, you should change the second parameter, the one telling gluPerspective the windows aspect ration (height relative it's width)
Aspect ratio = height / width, and this is the value you pass to gluPerspective. If you are using another function to setup projection matrix but still are unsure how to do, ask again.
09-21-2001, 12:21 AM
I've been using gluPerspective, but with aspect ratio as width/ height. using height /width just gives me the background colour.
in the middle of the window is a model of a helicopter, which moves according to flight data.
when the helicopter is side on, the image is stretched, so the helicopter appears longer than it should.
if it is nose (or tail) on to the viewer, it appears wider than it should.
i would like to display the helicopter in the correct proportion, with the slightly wider window, but it just won't work.
09-21-2001, 02:03 AM
Dunno if this helps, but I usually prefer to use glFrustum instead of gluPerspective. It seems more intuitive to me. Function prototype is glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar) where the params define the corners for the viewing frustum. Try it out.
Hope that helps.
09-21-2001, 12:02 PM
I had the same problem, and I was advised the same thing...glFrust ....seems to work much better....but I also made the mistake of doing glRotate in my Projection matrix
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.