Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Possibility

Objects being distorded at the corners of the screen

This topic is 5224 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

I am rendering some spheres in different places on the screen. If they are rendered at the center, they appear as a perfect sphere shape, but if they are rendered at the corners, they become oblonged oval shaped. I am using this to set the perspective matrix: Dim fAspect As Single = BackbufferWidth / BackbufferHeight Device.Transform.Projection = Matrix.PerspectiveFovLH(CSng(Math.PI) / 4.0F, fAspect, 1.0F, 100.0F) What do you guys use for the PerspectiveFovLH to get spheres to look as spheres anywhere on the screen? Possibility

Share this post


Link to post
Share on other sites
Advertisement
"CSng(Math.PI) / 4.0F"

Try changing that to CSng(Math.PI)/2.0f and it should be fine.

[edited by - Cypher19 on February 29, 2004 12:49:44 AM]

Share this post


Link to post
Share on other sites
Thanks for the replay, but it made it worse, so I went the other way and devided PI by 8, and now spheres are round anywhere in the image.

Possibility

Share this post


Link to post
Share on other sites
Dim fAspect As Float = (Float)BackbufferWidth / BackbufferHeight

You should be using floating point as your aspect ratio, since it will be a decimal (the decimal part is important, too, in this case).


Dustin Franklin
Mircrosoft DirectX MVP

Share this post


Link to post
Share on other sites
quote:
Original post by Possibility
A single is a floating pointing number in VB.
Ahh okay. Make sure you still do:
Dim fAspect As Single = (Single)BackbufferWidth / BackbufferHeight
backbufferwidth and backbufferheight are not floating point, hence the explicit cast.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!