gluProject doubt

Hello

I need to detect the colision between a line and a rectangle.

The procedure i am using is something like this:

  1. Convert the line world coordinates into window coordinates using gluProject.
  2. Check the colision between the line and the rectangle (the rectangle is in window coordinates).

Although this procedure works fine i am having problems if the line isn’t totally onscreen.

For example, if one line starts at the left of the window screen i was expecting that gluProject returned a negative X coordinate, but it doesn’t…

What i am missing here? Thank you for your help.

for collision why are you projecting into windows coordinates? can’t you check collision in world coordinates?

i guess i could do that… but i didn’t know how to handle the Z coordinate so i took this approach…

By the way this is working now using the procedure i mention, maybe i was doing something wrong anywhere else in the code…