Sorry , how can I transform 2D screen coordinates (given by the mouse) on 3D coord.

I want to draw a 3D object where I click on the screen, depending on ViewPort Matrix(Sorry for my poor English), I also want to know how can I get the Viewport matrix or how can I compute it. Thank for your support

look into this and the beginners section.
i remember i’ve posted a simple routine to do this task.