1 / 20

Three Dimension Viewing

Three Dimension Viewing. glMatrixMode(GL_PROJECTION); //make the projection matrix current glLoadIdentity(); // start with a unit matrix gluPerspective(viewAngle,aspectRatio, N, F) // load the appropriate values fig.7-4. Building camera in a program. class Camera{ private: Point3 eye;

yael
Download Presentation

Three Dimension Viewing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Three Dimension Viewing

  2. glMatrixMode(GL_PROJECTION); //make the projection matrix current glLoadIdentity(); // start with a unit matrix gluPerspective(viewAngle,aspectRatio, N, F) // load the appropriate values fig.7-4

  3. Building camera in a program class Camera{ private: Point3 eye; Vector3 u,v,n; double viewAngle, aspect, nearDist, farDist; // view volume shape void setModelviewMatrix(); // tell OpenGL where the camera is public: Camera(); // default constructor void set(Point3 eye, Point3 look, Vector3 up); // like gluLookAt() void roll(float angle); // roll it void pitch(float angle); // increase pitch void yaw(float angle); // yaw it void slide(float delU, float delV, float delN); // slide it void setShape(float vAng, float asp, float nearD, float farD); };

  4. Perspective projection of 3D objects

  5. Projection

  6. 7.4.1 (x*,y*)=(N* (Px/-Pz), N* (Py/-Pz))

  7. Center in origin, E=5 in Z Center in (1,1,1), E=5 in Z

  8. 7.4.3. Straight lines project as straight lines: the parametric form point A(Ax,Ay,Az) direction vector c=(cx,cy,cz) P(t) = A + ct

  9. 7.4.10

  10. Taxonomy of Projections

  11. Vanishing point

  12. Parallel projection orthogonal and oblique Orthogonal, the projection direction Is parallel to n Oblique not parallel to n

  13. Multiview orthogonal projection 7.6.5

  14. Oblique projection 7.13

  15. void Camera:: setOblique(Vector3 d,..others..) {// establish camera for oblique projections glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(l,r,b,t,n,f); // set the projection matrix if(d.z == 0.0) return; // for orthographic projections float m[16]; // space for a 4 by 4 matrix for(int i = 0; i < 16; i++) // start with identity matrix m[i] = (i%5 == 0)? 1.0 : 0.0;// identity matrix m[8] = -d.x/d.z; // add the shear terms m[9] = -d.y/d.z; glMultMatrixf(m); // postmultiply it by m }

  16. Perspective vs. parallel

  17. Classical projections

  18. 7.6.8

More Related