PDA

View Full Version : Skewing of glut primitives problem!



link664
05-18-2005, 12:18 AM
Hi,
Im currently making a human model that can be animated. for some reason when i rotate the model about the torso in any axis (x, y or z) the model becomes skewed. I use glut primitives (glutSolidSphere and glutSolidCube) for the model. When i say skewed i mean that the objects are displayed out of proportion, for example the head instead of being a sphere of radius 1.5, it becomes and oblong. Just wondering if anyone has any idea what could be causing this because ive been working on it for hours!!

Thanks for you help, link664

Relic
05-18-2005, 01:37 AM
Does the aspect ratio of window's client area match the aspect ratio of your projection?
Here's a piece of code correcting the aspect ratio:
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=013367
For gluPerspective it's even simpler.

link664
05-18-2005, 02:01 AM
i use a perspective view, not orthogonal, but my aspect is right anyway im pretty sure.

the entire code is located here:

http://yallara.cs.rmit.edu.au/~dnatoli/code.htm

and i have posted sum pictures as well showing the distortion:

http://yallara.cs.rmit.edu.au/~dnatoli/model.htm

if that will helps you.

Thanks, link664

Relic
05-18-2005, 02:58 AM
i use a perspective view, not orthogonal, but my aspect is right anyway im pretty sure.
Your reshape function looks broken (same instruction in both if-branches) and will crash for zero height windows.

Zooming is not done with a scale, but with a different field of view in the gluPerspective call.

You have a glScale at a place where it affects the following transformations. Make sure you never have a non-uniform scale with that.
Check zoom == 1.0.
You need to read from the glVertex call upwards to get the OpenGL (left-multiplied) transformation hierarchy. The scale also affects the translations.