XMMatrixOrthographicLH Question

Started by
1 comment, last by Ralara 11 years, 3 months ago

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!

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?

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 !!

This topic is closed to new replies.

Advertisement