Jump to content
  • Advertisement
Sign in to follow this  
johnnyBravo

How to stop my squares looking like rectangles?

This topic is 4888 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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 Window
D3DXMatrixPerspectiveFovLH(&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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!