Jump to content
  • Advertisement
Sign in to follow this  

picking in opengl

This topic is 3319 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 am able to do ray casting in 3d using this code GLint viewport[4]; GLdouble mvMtx[16], projMtx[16]; GLint realy; GLdouble wx=0, wy=0, wz=0; //returned world coords glGetIntegerv(GL_VIEWPORT, viewport); glGetDoublev(GL_MODELVIEW_MATRIX, mvMtx); glGetDoublev(GL_PROJECTION_MATRIX, projMtx); realy = viewport[3] - (GLint)y - 1; gluUnProject (x, realy, 1.0f, mvMtx, projMtx, viewport, &wx, &wy, &wz); How can I implement similar thing in glOrtho mode? I have tried by just setting the wx, wy, to be screen coords, and then setting z to -1000, but nothing works. Can any one please help Regards Kazz

Share this post


Link to post
Share on other sites
Advertisement
If you are working in ortho mode and drawing everything in screen space than maybe you don't need to do ray casting because your objects and mouse cursor will be in the same coordinate system.You can just check if your cursor is over the objects.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!