Viewing Matrix

I’m having a bit of a problem with creating a viewing matrix and i reckon I’ve done it so terribly wrong. I create my U V and N as follows:


	U=CrossProd_Vector3(upVector, N);
	V=CrossProd_Vector3(N, U);

	CU=DotProd_Vector3(position, U);
	CV=DotProd_Vector3(position, V);
	CN=DotProd_Vector3(position, N);

all my functions for the dot products and cross products are working. If i set the position to (0, 0, 0) it does actually work but anything else it all just disapears. upvector is (0, 1, 0) and direction is (0, 0, -1).

If anyone could help i would be most grateful.


to begin, N should be direction - position, not the other way around. Remember, always final minus initial.