Drawing a line in 3d space with the mouse.

I’m trying to draw a series of lines that use a set of points that are laid down by the user with the mouse. so the user would lay down a set of points by clicking on the window at various points, then the lines would be drawn. this works great in a 2d environment but as soon as i try to implement this in 3d i can’t lay down any points. can anyone point me to a tutorial that explains how to do this?

Maybe you can be more specific where your problem is? Are you using screen coordinates for the points? What may be happening is you’re drawing 2D points outside your clipping planes.

On a conceptual note, how do you get the depth component from a 2d screen coordinate? I think you need to define a plane in which to draw the line.