Right now my application rotates on camera.rotationX, Y Z and does a -translation of camera.x,y,z on the modelview matrix. How could I equivocate this to a call to gluLookAt?
Thanks
basically how could I get this:
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
//starts here
glRotatef(Camera.rotx,1,0,0);
glRotatef(Camera.roty,0,1,0);
glRotatef(Camera.rotz,0,0,1);
glTranslatef(-Camera.x , -Camera.y - 4.5,-Camera.z );
Instead into a call to gluLookAt which would make it look the same.
Thanks
The reason I want to do this is because I found a fustrum culling class that works with gluLookAt as seen below
void FrustumG::setCamDef(Vec3 &p, Vec3 &l, Vec3 &u) {
Vec3 dir,nc,fc,X,Y,Z;
Z = p - l;
Z.normalize();
X = u * Z;
X.normalize();
Y = Z * X;
nc = p - Z * nearD;
fc = p - Z * farD;
ntl = nc + Y * nh - X * nw;
ntr = nc + Y * nh + X * nw;
nbl = nc - Y * nh - X * nw;
nbr = nc - Y * nh + X * nw;
ftl = fc + Y * fh - X * fw;
ftr = fc + Y * fh + X * fw;
fbl = fc - Y * fh - X * fw;
fbr = fc - Y * fh + X * fw;
pl[TOP].set3Points(ntr,ntl,ftl);
pl[BOTTOM].set3Points(nbl,nbr,fbr);
pl[LEFT].set3Points(ntl,nbl,fbl);
pl[RIGHT].set3Points(nbr,ntr,fbr);
pl[NEARP].set3Points(ntl,ntr,nbr);
pl[FARP].set3Points(ftr,ftl,fbl);
}