   Need Help: Ortho Matrix Math
  I'm in the process of writing my own matrix math (row-major, left-handed) functions, however I cannot get the math right for Otho Projection. here is what I have:// For reference// struct Mat4x4// {// Float _11, _12, _13, _14;// Float _21, _22, _23, _24;// Float _31, _32, _33, _34;// Float _41, _42, _43, _44;// } mRaw;m_tProjMatrix.mRaw._11 = 2.0f / fWidth;m_tProjMatrix.mRaw._22 = 2.0f / fHeight;m_tProjMatrix.mRaw._33 = 1.0f / (m_fFarClip - m_fNearClip);m_tProjMatrix.mRaw._43 = m_fNearClip / (m_fNearClip - m_fFarClip);m_tProjMatrix.mRaw._44 = 1;What I end up is an Orthogonal projection with (0, 0) in the center and (-1, -1) in the bottom left and (1, 1) in the top right. Is it possible to modify this math so that I get (0, 0) in the top left and (width, height) in the bottom right? Thanks.[Edited by - RealMarkP on May 14, 2010 3:12:42 PM]
  I create an ortho the same way, well almost, my _43 ism_tProjMatrix.mRaw._43 = m_fNearClip / (m_fFarClip - m_fNearClip);I'm not sure which way is correct, but I'm doing 2d so it's not a concern yet.Then I prescale by (1,-1,1)and PreTranslate by (-(width/2), -(height/2), 0);  Thanks for catching that. It still doesn't solve my problem. // Fixed:m_tProjMatrix.mRaw._43 = (-m_fNearClip) / (m_fFarClip - m_fNearClip);;  Do you have a prescale or pretranslate?I guess you don't need a prescale, just negate _22This is my pretranslate function, using vector3(-(width/2), -(height/2), 0)inline void matrix4::PreTranslate( const vector3& Translation ){M[3][0] += (M[0][0] * Translation.X) + (M[1][0] * Translation.Y) + (M[2][0] * Translation.Z);M[3][1] += (M[0][1] * Translation.X) + (M[1][1] * Translation.Y) + (M[2][1] * Translation.Z);M[3][2] += (M[0][2] * Translation.X) + (M[1][2] * Translation.Y) + (M[2][2] * Translation.Z);M[3][3] += (M[0][3] * Translation.X) + (M[1][3] * Translation.Y) + (M[2][3] * Translation.Z);}