What is the best way to plot a pixel in a three dimensional graph based on the mouse position on the screen? When the user presses the mouse button the pixel should appear

where the mouse cursor is (which can be an infinite number of points going away from
the cursor position). I am guessing I should start by calculating a vector that
represents all posible values where the point could be plotted. Then I would need to
decide how far from the viewer to plot the point. I just have no idea how to go about
this mathematically.

This is for a simple project I am working on as part of my opengl education. I decided
to create a program that I can use to generate vertex arrays of scenes more quickly than coding glVertex3f() a million times and figuring out all the vertices by hand.

I believe that this function is used when you are trying to get the coordinates of an object that already exists. I am trying to figure out where to plot the object (in this case a point). I am going to look around some more on this function to see if I can actually use it. I will check back latter.

sorry to have questioned you. I tried gluUnProject and so far it works perfectly. I just needed to set the winz variable to zero. Thanks a lot ya bloke.