How to stop my squares looking like rectangles?
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
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
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:
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.
// 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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement