Jump to content
  • Advertisement

Archived

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

Laird

OpenGL OpenGL picking and transformation

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

hi! i got some problem! currently i'm working on picking and it works fine, but just, if i do not rotate or/and scale the object! what can i do to solve the problem? this ist my picking-function: C/C++ Code: if(Button != 0&& Button != 2 && Shift.Contains(ssShift)) { GLint viewport[4]; glGetIntegerv(GL_VIEWPORT, viewport); glSelectBuffer(BUFSIZE, selectionBuffer); glRenderMode(GL_SELECT); glInitNames(); glPushName(0); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); gluPickMatrix((GLdouble) X, (GLdouble) (viewport[3] - Y), 1.0f, 1.0f, viewport); glOrtho(-GetOrtho*sx, GetOrtho*sx, -GetOrtho*sy, GetOrtho*sy, -10000, 10000); DrawScene(true); //draw the object glMatrixMode (GL_MODELVIEW); glPopMatrix(); glFlush(); numOfHits = glRenderMode(GL_RENDER); collisionbool = true; MyResize(); /*MatrixMode, Viewport*/ Manipulate(); /*Object transformation (rotation, scale)*/ } what's wrong? thanks Laird [edited by - Laird on September 2, 2003 8:55:54 AM] [edited by - Laird on September 2, 2003 8:56:35 AM]

Share this post


Link to post
Share on other sites
Advertisement
quote:
Original post by Laird
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();

gluPickMatrix((GLdouble) X, (GLdouble) (viewport[3] - Y),
1.0f, 1.0f, viewport);

glOrtho(-GetOrtho*sx, GetOrtho*sx, -GetOrtho*sy, GetOrtho*sy, -10000, 10000);
DrawScene(true); //draw the object

glMatrixMode (GL_MODELVIEW);
glPopMatrix();



You''re pushing the Projection matrix then popping the modelview matrix!!!

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!