Sign in to follow this  

DX/GL Transformation Matrices

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this