Jump to content
  • Advertisement
Sign in to follow this  

DX/GL Transformation Matrices

This topic is 4525 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 Once again Iam having problems with dx/gl transformation matrices. I completely dropped the fixed function pipeline, and Iam exclusively using CG. So what Iam doing in most cases is multiply World/View/Proj to the WorldViewProj matrix and transmit it as one uniform to CG. For GL, Iam just leaving them the way my matrix functions produce them. For DX, Iam transposing the matrix before transmitting it. The matrices itself were generated using equations from the D3DX documentation of the RH perspective/lookat functions. This works fine for both gl/dx ( and I actually thought I had sorted out all problems I was having earlier ). Now I wanted to render the reflected world to a rendertexture ( mirror effect ). So what I did is: Set up my camera class in a way that it multiplies the View matrix that would usually be generated, by a Matrix that scales z by -1. The weird thing is that in gl, this works just fine, while in dx it doesnt ( further investigation has shown that the screen space coordinates are mirrored in the y coordinate. So when I add some "texcoord.y=1.0-texcoord.y;" in my fragment shader that processes the rendertexture it works for dx as well ). Does anyone have any idea what might go wrong in the dx case? Why does scaling the view matrix's z by -1 invert the y coordinate of the resulting screen space coordinates? As I said, theyre both working correctly when Iam not mirroring anything. Thanks alot

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!