Jump to content
  • Advertisement
Sign in to follow this  

OpenGL Mouse interaction

This topic is 3786 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'm having alot of trouble with implementing mouse interaction like you'd find in a Real-Time-Strategy - where you click on the screen your units move to etc. I think my problem is keep track of the 'lens' of the camera. Currently I'm treating the near clipping plane as the plane as the plane the user clicks on with the mouse - i.e. everything is drawn on the near clipping plane and shown on-screen. The co-ordinates of where the mouse clicks on the screen then map to co-ordinates on the near clipping plane. Then from these co-ordinates I project a line along the near clipping plane's normal to see where it hits the 'field of play'. As far as I can tell my math is ok. So like I said I think my problem is that I'm failing to keep track of where the near clipping plane is when I use the glLookAt(); command, or perhaps I'm just completely dense and have mis-understood something major in the way OpenGL works :s . I've been tinkering with it for days and haven't got anywhere so ANY help of advice etc. would be much appreciated.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!