Infinite projection matrix (Pinf) -> Trouble!

I am trying implent stencil shadows in my program and I need the Pinf-matrix badly.
The problem though, is that I can’t get it working in any reasonable way. (That means that I cannot see anything)
I hope you can find some error in my code thanks a lot!

float Near = 2.0;
double tangent = tan(Config.ScreenFOV / 2.0);
float y = tangent * Near;
float x = (3 / 4) * y;

float right = x;
float left = -x;
float bottom = -y;
float top = y;

float Pinf[4][4];
const float NUDGE = 0.9999f;

// zero out the matrix
Pinf[0][0] = Pinf[1][0] = Pinf[2][0] = Pinf[3][0] = 0.f;
Pinf[0][1] = Pinf[1][1] = Pinf[2][1] = Pinf[3][1] = 0.f;
Pinf[0][2] = Pinf[1][2] = Pinf[2][2] = Pinf[3][2] = 0.f;
Pinf[0][3] = Pinf[1][3] = Pinf[2][3] = Pinf[3][3] = 0.f;

// create view matrix with infinite far plane
Pinf[0][0] = 2.0 * Near / (right - left);
Pinf[1][1] = 2.0 * Near / (top - bottom);
Pinf[2][2] = -2.f * Near;
Pinf[2][2] = NUDGE * -1.f;
Pinf[2][3] = -1.f;
Pinf[3][2] = Near * NUDGE * -2.f;
Pinf[2][0] = (right + left) / (right - left);
Pinf[2][1] = (top + bottom) / (top - bottom);

glMatrixMode(GL_PROJECTION); glLoadMatrixf(&Pinf[0][0]);
gluLookAt(ViewMat[12],ViewMat[13], ViewMat[14],
ViewMat[8] + ViewMat[12],
ViewMat[9] + ViewMat[13],
ViewMat[10] + ViewMat[14],
ViewMat[4], ViewMat[5], ViewMat[6]);

Thanks for the help!

Well, I managed to put the code in a place where it actually seems to do some good.

I do get correct shadows in more cases now, but it still isn’t quite right.
There is a chance that an other part of my shadow-code is wrong. But please have a look on the above code (Pinf related only) and see if you can find any thing.

BTW it is: float x = ((float)4 / 3) * y;

Yeah! I just found another stupid error!
When dealing with shadow-volumes I calculated the backfaces relative to the camera instead of the light. It works so (!) much better now.
Ah, that’s a good feeling

[This message has been edited by B_old (edited 04-07-2003).]

Always good to read the last response in a thread like this first.