I'm working on a simple demo app. What i need to do is convert a point in 3D space to a point in 2D space (in this case my screen).

I was thinking of creating a vector from the point where the 4 viewport edges meets behind the camera, to the point in 3D, and detect the intersection point in the nearclipping plane. But from there, im lost. I also know that the nearclipping plane can be both infront of the camera and behind.

Any one got any good ideas ?