Sign in to follow this  
ogl5

perspective

Recommended Posts

I always see these complicated and poorly explained formulas for perspective projection, and I'm not sure if I'm doing it right. Let's say I have the 3d point a. Now let's say the new 2d screen coordinate is a2d. Is this code correct for converting the 3d point to 2d? Vertex2d a2d; a2d.x = a.x / a.z * SCREENWIDTH; a2d.y = -a.y / a.z * SCREENHEIGHT; a2d.x = a2d.x/2.0f + SCREENWIDTH/2.0; a2d.y = a2d.y/2.0f + SCREENHEIGHT/2.0; If not, what's wrong with it? Thank you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this