   Question regarding to the Matrix Manipulation
  Hey guys, I'm here to seek for some help again :(So what I want to do is I call a function and I'll pass a MATRIX inside and I wanna change the VALUE (like _11, _12 and so on) inside the MATRIX. So what I did was: void MyCamera::setViewMatrix(D3DXMATRIX& V){V._11 = right.x;V._12 = up.x;V._13 = look.x;V._14 = 0.0f;V._21 = right.y;V._22 = up.y;V._23 = look.y;V._24 = 0.0f;V._31 = right.z;V._32 = up.z;V._33 = look.z;V._43 = 0.0f;V._41 = x;V._42 = y;V._43 = z;V._44 = 1.0f;} I thought the above function could change the value for each element inside the MATRIX but I was wrong. After that I found another method which had solved my problem.void MyCamera::setViewMatrix(D3DXMATRIX* V){    (*V) (0, 0) = right.x; (*V) (0, 1) = up.x; (*V) (0, 2) = look.x; (*V) (0, 3) = 0.0f; (*V) (1, 0) = right.y; (*V) (1, 1) = up.y; (*V) (1, 2) = look.y; (*V) (1, 3) = 0.0f; (*V) (2, 0) = right.z; (*V) (2, 1) = up.z; (*V) (2, 2) = look.z; (*V) (2, 3) = 0.0f; (*V) (3, 0) = x; (*V) (3, 1) = y; (*V) (3, 2) = z; (*V) (3, 3) = 1.0f;}Instead of using pass by reference(&), I need to use pointer.But what I don't understand is, I thought the first method is the same as the second? Anyone can explain for me? Thank You.   
  Probably if you show us the rest of the code, where you actually have that matrix declared and call setViewMatrix(..)I have a feeling, that you are implementing a const reference by accident.;  Alright, here it is.void MyCamera::update(){D3DXMATRIX V;setViewMatrix(V);   pd3dDevice->SetTransform(D3DTS_VIEW, &V);}This is the only place I call setViewMatrixPS: this is the way I call setViewMatrix IF I used the first method which is pass by reference. IF I used second method which is pass a pointer then I have to put a & infront of V:void MyCamera::update(){D3DXMATRIX V;setViewMatrix(&V);pd3dDevice->SetTransform(D3DTS_VIEW, &V);};Quote:Original post by birdkingzI thought the above function could change the value for each element inside the MATRIX but I was wrong.So what makes you so sure that it's not changing each element? Have you tested to see whether elements have changed after calling the function? My suspicion is that what you're actually looking at is the output of the program, which will be different depending on whether you use the first or second version of your function because the first version has a typo: 5th line up from the closing bracket.   ;  OMG! really is that TYPO makes my whole program didn't work >.<..Thanks alot :)