I'm afraid my experience with OpenGL is very limited. However, in my class, we have done quite a bit of perspective projections and rotations.
The basic for idea for rotation is like what I said before. Working in homogenous coords:
1) Translate all objects such that the eye position is now at the origin.
2) Rotate the objects such that the vector from the eye to the center of interest is aligned with the z-axis. This done by what is called the "general rotation matrix".
3) Divide all x,y,z values of a point by it's w.
Here is a bit of code I wrote for my last project. It calculated the GRM. (note: y is up, x is back and forth, z is out -- different from typical mathematical 3d space [where z is up])
[code]
void calculateGRM(double grm[4][4])
{
double Vx[3], Vy[3], Vz[3]; // three vectors that form a right 3d space
double topVector[3] = {0, 1, 0}; // some vector that is points straight up.
Vz[0] = coiX - posX; // let Vz = the vector from the eye to the center of interest
Vz[1] = coiY - posY;
Vz[2] = coiZ - posZ;
/*Cross Vz with straight up vector to find Vx*/
VectorOps3d::cross(topVector, Vz, Vx);\t// cross of topVector and Vz stored to Vx
/* Cross Vz w/ Vx to find Vy */
VectorOps3d::cross(Vz, Vx, Vy);\t\t// cross of Vz and Vx stored to Vy
VectorOps3d::normalize(Vx);
VectorOps3d::normalize(Vy);
VectorOps3d::normalize(Vz);
for(int i = 0; i < 3; i++)
{
grm[0][i] = Vx[i];
grm[1][i] = Vy[i];
grm[2][i] = Vz[i];
}
}
</pre><hr></blockquote>
Note that the forth row and columns are all = 0 except for grm[3][3] -- that is = 1.
Now simply take all your points and multiply them by grm (grm should be on the left).