0

I'm not really sure if it makes sense but I need to do and there is a chance there won't be any obstacle in front.

DogDog
  • 4,820
  • 12
  • 44
  • 66

1 Answers1

0

Is's not clear what you mean by tracing but :

1 You may be looking for gluUnProject to go from screen coordinates to space coordinates. With the help of the Z buffer for distance from camera, you can get the coordinates of 3D point which is seen at the specified pixel.

2 you want to draw a 3D line from camera origin to some 3D point at the mouse cursor. Well it's just a point at the mouse cursor.

fa.
  • 2,456
  • 16
  • 17
  • I'm not sure I understand, If I point at the cursor, isn't the cursor position only in x,y and is relative to the window? – DogDog Apr 01 '11 at 22:46
  • the window (or projection) plane has a position in space : the distance between the camera origin and this plane is the focale distance. Look at the figure here http://www1.cs.columbia.edu/~jebara/htmlpapers/SFM/node6.html – fa. Apr 02 '11 at 12:31
  • Ok now if I understand well, to get that vector all I have to do is gluUnproject with the coordinate of the mouse. Since the camera is set a (0,0) the 3d point that I will have found will be the same as the vector I am trying to find. – DogDog Apr 08 '11 at 21:10