PDA

View Full Version : Please help !!!



vamsee kanth
01-03-2005, 07:31 AM
Hello,

I have a 3-D line and when i click with mouse on a certain point i want the original coordinates which i have used to plot the line to be retrieved.

plz help !!!.

this is really urgent and important.

any sample code would be highly useful.

vamsee

mikael_aronsson
01-03-2005, 11:42 PM
Hi !

You can use opengl selection mode to do the hit testing, this will give you a depth value that you can convert to a Z coordinate, then if you have the original modelview matrix I guess you could use that to find the coordinate of the hit by interpolating between the end points of the line.

Another alternative would be to split up the line in many small line segments when you render it, then you could do opengl selection on each line segment, if you have small enough line segments one hit would represent about one pixel.

Mikael