3D Perspective Projection

Hello, I've been trying to figure out perspective projection for a couple days now. Does anyone have an example of how to do it? I would appreciate if its in C++. Don't point me to Wikipedia it is not usefull to me.

I use GLM for graphics related matrix math in C++. It will do perspective projection matrices for you. If you want to do it yourself, you can look at the source and see how it's done.

http://glm.g-truc.net/0.9.4/index.html

That's nice, but I am trying to do it myself. Do you know of any article that in depth explains it and shows sample code. I'm still trying to wrap my head around some of the basics concepts like what the variables and everything represent in perspective computation. Like in this http://www.arcsynthesis.org/gltut/Positioning/Tut04%20Perspective%20Projection.html I don't understand half of what the author is doing.

I don't know of any in depth articles. If you have a grasp of linear algebra, it shouldn't be too hard. For example, in the perspective computation formula you mentioned, E, P, and R are points in space, could be 3d, or 2d, so for example [x, y, z]. The data structure will be whatever you make it, since you are doing everything on your own. You might choose a struct point { double x, y, z; }; or maybe you will make a class. Then you will need to implement several vector and matrix math operations, and functions to calculate things like the distance between two points: Ez, z distance from eye point to projection plane. Pz, z distance from eye to point.

Wait till you get to [x, y, z, w], or transformation matrices... and don't get me started on quaternions!

It's SUPER math heavy. If you don't have the foundation in math to work with, that would be a good place to start. Otherwise, you won't understand what's being explained.

I've found this article which seems to be very helpful. http://www.math.utah.edu/~treiberg/Perspect/Perspect.htm I have done the examples up to perspective projection. I cannot figure out what some of the stuff like this line: Let rdp= R(dp)=(0, rdp2, rdp3) be the rotated dp. I would appreciate if someone could take the time to create code demonstrating this and post it on the forums with comments saying what is happening.