Jump to content
  • Advertisement
Sign in to follow this  
langtudontinh

How to translate screen coordinate to texture coordiante?

This topic is 4876 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 have an image texture displayed on screen, the problem is I want to get mouse input and translate its position to texture coordinate. Just want to draw multi-line on the texture. I greatly appreciate your answer!

Share this post


Link to post
Share on other sites
Advertisement
Thank for your reply.
I understand the formula, but I think you missed my question. I don't know howto map the mouse-clicked position (2D space) to 3D space (the camera placed at any position in world space), then this point will be translated to a texture coordinate.

Share this post


Link to post
Share on other sites
What you are trying to do is commonly referred to as "picking". There are lots of topics floating around here about it (unfortunately, the search has been "Temporarily Disabled" for like a billion freaking days - you can still do a less-effective Google search though).

This may be a helpful topic.
Improved Ray Picking

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!