View Full Version : Pick-ray selection and window reshape

charlie mac
04-24-2008, 10:53 PM
I am trying to implement ray-cast selection against AABBs. My current scene has one box whose edges change color on successful Ray-AABB intersection. The ray is created on mouse click with gluUnproject. So far everything works fine until I change the size of the window. After changing the size of the window, pick-rays have a steeper y-slope thus missing the target.(I also render each pick ray with t=10 to see what's going on) I am having trouble tracking down the cause of this.

Here is the procedure for my Reshape routine:
- call glviewport w/ updated window size info
- update aspect ratio variable with width / height
- load projection matrix
- load identity matrix
- call gluPerspective with fov, aspect, near, far
- finally load modelview matrix

There has to be something obvious I'm missing or not updating here, I just can't for the life of me figure out what it is. Any ideas?