Jump to content
  • Advertisement

Archived

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

Lestat3D

OpenGL I need help from an opengl guru

This topic is 5729 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, lets get into the situation... I''m building an application that draws a square with opengl using a triangle list of two triangles. Well, that works fine, but I have to know what textures coordinates the mouse is over. I''ve serching the web for any tutorial or refference explainning some of ray picking, but nobody could explain me how to get the textuer coordinates under the cursor nor triangle barycentric coords. Please help meeeeeeeeeeee!

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Use glReadPixels with the mouse x and y coordinates, this will give you a depth value (from the depth buffer)

Use this depth value in gluUnproject to give you the 3D x, y and z coordinates

The next bit will be specific to your app, you will need to use the x,y and z values to determine which triangle the pixel is part of and where on the triangle it lies

Then map this position to your texture coordinates

Why do you need the texture coords?

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!