OpenGL Selection Picking Fails

Why is it when I move either my camera or viewport, the OpenGL selection picking no longer works?

Thanks in Advance

You probably messed up the matrices.

Or you have not converted the picking position from windows top-left origin to OpenGL’s bottom-left?

Have a look at the sample in the gluPickMatrix manual.

When rendering a scene as follows:

glMatrixMode(GL_PROJECTION);  
glLoadIdentity( );  
gluPerspective(. . .);  
glMatrixMode(GL_MODELVIEW);  
/* Draw the scene */ 
  
the following code selects a portion of the viewport:

glMatrixMode(GL_PROJECTION);  
glLoadIdentity( );  
gluPickMatrix(x, y, width, height, viewport);  
gluPerspective(. . .);  
glMatrixMode(GL_MODELVIEW);  
/* Draw the scene */

[This message has been edited by Relic (edited 06-26-2002).]