How to stop my squares looking like rectangles?

Started by
6 comments, last by johnnyBravo 19 years ago
Hi, I'm using direct3d9, to draw a 3d cube. But it just looks like a rectangle. I guess that is because of the computer screen being a rectangle making the pixels or something rectangles. But is there anything I can do about it, to stop my stuff from getting stretched horizontally? Thanks
Advertisement
What coordinates are you feeding it?
Disclaimer: "I am in no way qualified to present advice on any topic concerning anything and can not be held responsible for any damages that my advice may incurr (due to neither my negligence nor yours)"
for one square its like:

0 , 0 , 0
100, 0 , 0
0 , 100, 0
100, 100, 0
I think it may have to do with how your viewport is setup. If you have an incorrect aspect ratio or other settings, then I think it might make them look like rectangles rather than squares.
How do you set the aspect ratios? All I can see in the viewport struct is
DWORD X;
DWORD Y;
DWORD Width;
DWORD Height;
float MinZ;
float MaxZ;

Anyway I didn't touch the viewport my program, am I supposed to?

thanks
I am not sure if I am using the right terminology, but going from one example (NeHe's Basecode) they do something like this:

// Calculate The Aspect Ratio Of The WindowD3DXMatrixPerspectiveFovLH(&matProjection, 45.0f, (float)width/(float)height, 0.1f, 100.0f );

Now if you aren't using this specific function, then probabally ignore me [smile]. Just some suggestions from an OpenGL point of view - I know if I were to set up the aspect ratio to something like Height/Width instead, everything would look more 'rectangular', but I don't know how you could fix it in your program. More than likely this probabally is not the problem, just a random shot in the dark.
You shouldn't need to mess with the viewport. How are you setting up your projection matrix? If you're using the D3DXMatrixPerspectiveFovLH function, you need to make sure the aspect parameter is your window width / height.
thanks that what it was. I hadn't modified it, since I pulled it from the second d3d tutorial

This topic is closed to new replies.

Advertisement