This topic is now archived and is closed to further replies.

Inaccurate picking

This topic is 5094 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

im trying to pock objects in my scene, but it doesnt work accurately. It seems like the object is moved a bit down for the picking - if i click a bit under the object a still pick it and when i click at the top of the object i dont pick it. This is mt selection code : GLuint buffer[512]={0}; GLint viewport[4]={0}; GLint choose; GLint hits; GLint depth; glGetIntegerv(GL_VIEWPORT,viewport); glSelectBuffer(512,buffer); (void) glRenderMode(GL_SELECT); glInitNames(); glPushName(-1); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); gluPickMatrix((GLdouble)MouseX,(GLdouble) (viewport[3]- MouseY),0.1f,0.1f,viewport ); gluPerspective(Config.scnViewAngle_i, (float)(viewport[2] - viewport[0]) / (float)(viewport[3] - viewport[1]),Config.scnNearClip_f ,Config.scnFarClip_f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); //////////////////////////////////////////////////////////////////// Loop(1);//Draws the scene //////////////////////////////////////////////////////////////////// glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); hits = glRenderMode(GL_RENDER); if (hits > 0) { choose = buffer[3]; depth = buffer[1]; for (int loop=1;loop

Share this post

Link to post
Share on other sites