Jump to content
  • Advertisement

Archived

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

beebop

Picking

This topic is 5220 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

I''ve got a problem with the openGl picking. Here my code called after a mouse event: // void myView:icking(int mouseX, int mouseY) { GLint viewport[4] ; GLuint selectBuf[32] ; GLint hits ; glGetIntegerv (GL_VIEWPORT, viewport); glSelectBuffer (512, selectBuf); (void) glRenderMode (GL_SELECT); glInitNames(); glPushName(0) ; glMatrixMode(GL_PROJECTION) ; glPushMatrix() ; glLoadIdentity() ; gluPickMatrix(mouseX, viewport[3] - mouseY, 5, 5, viewport); gluPerspective( 45.0, (GLfloat)_viewW/(GLfloat)_viewH, _camera.getDistance()*0.1f, _camera.getDistance()*20.0f ); glMatrixMode(GL_MODELVIEW); glF1CRDraw(GL_SELECT); hits = glRenderMode(GL_RENDER); processHits(hits, selectBuf); glMatrixMode(GL_PROJECTION) ; glPopMatrix(); glMatrixMode(GL_MODELVIEW); } // In the drawing function, I put my glPushName or glLoadName (not between glBegin or glEnd). When I treat number of hits, I always obtain 0 !! What could be the problem ?? Camera ? .... Thanks a lot

Share this post


Link to post
Share on other sites
Advertisement
When I do a glGetError(); after glLoadName or
glPushName, I''ve got:
GL_INVALID_OPERATION is generated if glLoadName
is called between a call to glBegin and the corresponding call to glEnd.
I don''t understand ?!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!