How to get the coordinate in OpenGL

Does anyone could help?
I had to get the coordinate where the mouse pointed. I tried the gluUnProject function but didn’t work. How can I get it?

The fact is that if you point the mouse in the window, let’s say at (xw, yw), by projecting in 3d space, you should get a line of infinite points, which is orthogonal to the viewing plane: I had the same problem and couldn’t work out something good with the gluUnProject: I have no clear idea how to set up the matrix for this operation.