Hello

Im trying to do a ray picking for quads drawn like this:

```
bool bCollided = IntersectedPolygon(vCube, vLine, 4);
float scval=1.1f;
for (int x = 0; x <= 1; x++) {
for (int y= 0; y <= 1; y++) {
glPushMatrix();
glTranslatef(scval * x, 0.0f, scval * y);
for (int z=1; z <= 1; z++) {
glPushMatrix();
glBegin(GL_QUADS); // Draw A Quad
if(bCollided) {
glColor3f(1.0f, 0.0f, 0.0f);
}else
{
glColor3f(0.5f, 0.5f, 0.5f);
}
glVertex3f(0.00, 1.00, 1); // Top Left
glVertex3f( 1.00, 1.00, 1); // Top Right
glVertex3f( 1.00, 1.00, 0); // Bottom Right
glVertex3f(0.00, 1.00, 0); // Bottom Left
glEnd(); // Done Drawing The Quad
glPopMatrix();
glTranslatef(0.0f, scval, 0.0f);
}// z
glPopMatrix();
}// y
}// x
```

Here is image:

http://i.minus.com/iMeDc6d83hjDg.JPG

As you see, picking only works for first quad, not for the rest of them.

For the rest, ray picking just doesn’t do anything.

Im very poor at 3D math and advanced openGL, but maybe here are experts who know what the problem is and how to solve it?

I googled alot, even tried to find some open source codes, with similar problem, but there isn’t anything.

Maybe it’s possible to get rid of the glPushMatrix() and glTranslatef() at all and still draw quads like so?

If somebody knows how to do that also, i would be very thankful.

This could fix the ray problem i have. I believe.

Thank you in advance.