does someone knows if it possible to rotate a camera and select object in real time ? my program allow you selection only if you translate but if you rotate the scene there is no results : no hits are sended to the program by opengl.thanks for your answer
Hi !
Yes that’s no problem, I think you make a mistake somewhere in your selection code, possibly when you setup the projection/modelview matrix, make sure you have selected the correct matrix before you set it up and son on.
Mikael
here is my selection routine i don’t see the mistake, can someone help me
#define BUFSIZE 512
void pickObjets(int x,int y)
{
GLuint selectBuf[BUFSIZE];
GLint hits;
GLint viewport[4];
glGetIntegerv (GL_VIEWPORT, viewport);
glSelectBuffer (BUFSIZE, selectBuf);
(void) glRenderMode (GL_SELECT);
glInitNames();
glPushName(-1);
glMatrixMode (GL_PROJECTION);
glPushMatrix ();
glLoadIdentity ();
gluPickMatrix ((GLdouble) x, (GLdouble) (viewport[3] - y),5.0, 5.0, viewport);
gluPerspective(45.0,(wwidth)/(wheight),1,2000);
/* glTranslatef (-eye[0], -eye[1], -eye[2]-50); //use to move the camera
glRotatef (rot[0], 1.0, 0.0, 0.0);
glRotatef (rot[1], 0.0, 1.0, 0.0);
glRotatef (rot[2], 0.0, 0.0, 1.0);*/
Dessine(GL_SELECT);
glFlush ();
hits = glRenderMode (GL_RENDER);
glMatrixMode (GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
afficheSel (hits, selectBuf);
}