My Models are not displayed correctly

Hi,

I’ve got a strange problem. I’ve implement an OBJ Model loader as well as a Collada Model loader. In both cases the problem is that my models are not in the correct dimension.

An example:
I have a dice (basically a simple cube) and now when I load and render it it is not a cube anymore (width is now longer than hight). Why is that? When I load my meshes inside other programs it displays them correctly no matter whether it is an obj or collada file.

Can anyone help me here??

Cheers

how have you defined your viewport? do you think your view could be stretched? when you rotate the model in the scene does it stay the same shape or does it stretch in one one direction in the view? If the model itself is always stretched along the same axis then you may have a glScalef() call before you render your model that is causing this or there might be something deeper…I don’t use the OBJ loader so I can’t help more.

hmm,

it is not a scalef somewhere before i render, even when i remove everything what scales my model is stretched.
I’ve tried it with a very simple cube with a edge length of 4, so the vertices which are read are all between -2 and 2.

The model is not stretched along one axis, it doesn’t matter if you look from the front, back, top, bottom, left or right. Everywhere the width is shorter than the length.

How can I check if my view is stretched? If I have done that, it was not on purpose. My viewport is a frame with a with of 1024 x 768 at the moment and the canvas inside it has a dimension of 1008 x 732. Can the problem be there that the dimension of the canvas is not correct anymore (for the width 16 were subtracted and for the height 56)? if it’s that, how can i solve that? The size of the canvas gets calculated automatically.

Have you set up your viewport with the correct aspect ratio?

this is what I meant to ask…if you have a bad aspect ratio (maybe a fisheye view) then that could be your problem…do you have a picture you could attach maybe. Or better, someone that actually has used the same loader would probably answer questions better than I.

Good, for the aspect I use 1.0 in gluPerspective.

I really think it is not with the loader because the problem is the same with my obj loader as well as the collada loader.

Alright, aspect ratio was wrong.

Just saw that I have to convert the width and height integers explicitly to the float I had. Now it works. thanks a lot.