Jump to content
  • Advertisement
Sign in to follow this  
Ralara

XMMatrixOrthographicLH Question

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

Quick question regarding the use of the XMMatrixOrthographicLH function.

 

After spending several days trying to figure out why I couldn't render any 2D objects in my game I finally realised I had the incorrect inputs to this function (all fixed and working now!), I'm just unsure why my original inputs were wrong.

 

I currently have a camera with a near z of 0.1 and a far z of 1500 just as default but when using these values to create the orthographic matrix nothing would be rendered on screen. I now use the same function but with values of 0 and 1 respectively and everything works.

 

If someone could explain that would be appreciated as documentation / google searches just say that the near z and far z values are required.

 

Thanks!

Share this post


Link to post
Share on other sites
Advertisement

What was the Z value of the vertices for your 2D objects? Perhaps the Z was getting set to 0, and they were getting clipped?

Share this post


Link to post
Share on other sites

Ah, turns out my Z was getting set to 0 and I hadn't noticed! I can't test my code right now but if I change it so the vertex Z is set to the near Z and use my original values, would I be correct in assuming it would work?

 

Thanks for your response though, makes a lot of sense. Always the simplest things that can be the hardest to spot when they are right in front of you tongue.png !!

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!