Jump to content
  • Advertisement
Sign in to follow this  
Jianxing

Detecting points under line

This topic is 3178 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, Was wondering how am I able to detect points or edges of an object under a drawn line. Take this example for intance, I load a cube object and I draw a line in front of it, making it look like 2 seperate halves.(how the line is drawn is by using the mouse dragged event and temporary disable the depth test) Now I would like to detect the points/edges under the line that can be seen on screen.How am I able to do that...? Thanks for the help...

Share this post


Link to post
Share on other sites
Advertisement
The framebuffer contains only pixel-data, no point or edge-data. The zbuffer lets you view/sample the data, that is not occluded. So, either:
- make your own set of maths functions to 3D-geometrically hittest the mouse's ray against points and lines. Requires some sorting and culling code.
or
- make use of the zbuffer. Draw 2px-wide lines as edges, and 2x2 px points as vertices over the already-rasterized scene. Of course, you have to colour-tag every object (line, edge, triangle). You could keep triangles black, if you don't need hittest on them.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!