I have my C# sample code posted at: opentk pitch rotation deforms the shape
As you can see in the code, I can draw and rotate the 3d object. What I want to do is: Given a 3d coordinate (x, y, z), how to get the projected 2d coordinate (x, y)?
Here is what I have so far:
int[] viewport = new int[4];
Matrix4 modelViewMatrix, projectionMatrix;
GL.GetFloat(GetPName.ModelviewMatrix, out modelViewMatrix);
GL.GetFloat(GetPName.ProjectionMatrix, out projectionMatrix);
GL.GetInteger(GetPName.Viewport, viewport);
// [x, y] = vec * modelViewMatrix * projectionMatrix * viewport