Advertisement Jump to content
Sign in to follow this  
KevinAlden

OpenGL Newb picking question

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

So I am new to opengl and just playing around with it currently. I have a simple texture displaying a bitmap right now and would like to implement some form of picking using the mouse location.

I have found a number of tutorials, but the examples I find would just tell me that the texture was clicked. Is there a picking method that would tell me which portion of my texture that was clicked?

Some additional background. My texture is displaying a bitmap of a gameboard. I am really just trying to figure out which region within the texture is clicked.

Thanks for any help/

Share this post


Link to post
Share on other sites
Advertisement
you can extract a ray from your camera by using the current mouse position, if you do an intersection test between this ray and the triangles that are used to construct the quad showing the texture you can use the resulting uv to calculate where exactly the user clicked.

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!