perspective

Started by
-1 comments, last by ogl5 16 years, 8 months ago
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.

This topic is closed to new replies.

Advertisement