title: DirectX 11.0 World Transform
body: <p>I am trying to render a cube in world space when i pass world XMMatrix as an Identity matrix , the cube gets rendered fine :
  <a href="https://i.stack.imgur.com/dYLV0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dYLV0.png" alt="Proper Cube"></a></p>
  
  <p>But when i try to add translation and scaling factors to the world matrix
  i get this :
  <a href="https://i.stack.imgur.com/qo8Sq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qo8Sq.png" alt="Problem"></a></p>
  
  <pre><code>/************************ TRANSFORM.CPP *********************/
  m_position = { 0.0f,0.0f,0.0f };
  m_scale = { 1.0f,1.0f,1.0f };   
  
  DirectX::XMStoreFloat4x4(&amp;m_matrix_translation , 
  DirectX::XMMatrixTranslation(m_position.x, m_position.y, m_position.z));
  DirectX::XMStoreFloat4x4(&amp;m_matrix_scalar,DirectX::XMMatrixScaling(m_scale.x, m_scale.y, m_scale.z));
  
   /************************* RENDER.CPP ***********************************/
  
  DirectX::XMMATRIX view = gp_MainCameraH-&gt;GetXM_View();
  DirectX::XMMATRIX world = GetXM_Scalar() * GetXM_Translation(); // if this is kept as Identity matrix , the cube gets rendered fine ( first image)
  DirectX::XMMATRIX proj = gp_MainCameraH-&gt;GetXM_Projection();
  
  DirectX::XMMATRIX vp = view * proj;
  DirectX::XMMATRIX wvp = world * vp;
  // Set the constant buffer of the shader
  RenderStateManager::GetEffectVariable("gWorldViewProj")-&gt;SetMatrix(reinterpret_cast&lt;float*&gt;(&amp;(wvp)));
  </code></pre>