index := col * 4 + row

so that e.g. col == 1 skips the first 4 elements (i.e. column vector 0) and addresses m1[4] up to m1[7] (i.e. the 2nd column) in dependence on row.

The second problem is with the order of inverseMat4 and setting the position vector. The position is an inherent part of the transformation. As such the camera matrix is a composition of

**M**:=

**T***

**R**

and its inverse is

**M**

^{-1}= (

**T***

**R**)

^{-1}=

**R**

^{-1}*

**T**

^{-1}

Your current computation gives

**T***

**R**

^{-1}

what is obviously different in 2 ways: The translation is not inverted, and the translation is applies on the wrong side.

So please invoke inverseMat4 as last step after setting all 4 columns and just before returning the view matrix result.

BTW: Notice please that setRowv is no longer for setting a row but for setting a column (assuming that you actually use column-major layout). It should hence look like

void setColumnV( Matrix4x4* m, int colNum, Vector3* v, float w ) { int index = colNum * 4 + 0; m->m.m1[index] = v->x; m->m.m1[++index] = v->y; m->m.m1[++index] = v->z; m->m.m1[++index] = w; }to avoid misguidance.