CSE 167 Lecture Notes - Lecture 5: Opengl, 3D Projection, Model Transformation

68 views3 pages

Document Summary

Summary: the whole viewing pipeline: start with model coordinates, apply a model transformation to get world coordinates, apply a camera (aka viewing ) transformation glulookat. 3d world - want to project to 2d: perspective transformation (gluperspective) Example: simply project onto xy plane, drop z coordinate. We have a cuboid that we want to map to the normalized or square cube form [-1,+1] in all axes. We have parameters of cuboid (l, r; t, b; n, f: translate, scale. Translation matrix: (1, 0, 0, 0, 0, 1, ,0, 0, 0, 0, 1, 0, - (l+r)/2, -(t+b)/2, -(n+f)/2, 1) Scale matrix: (2/(r-l), 0, 0, 0, 0, 2/(t-b), 0, 0, 0, 0, 2(f-n), 0, 0, 0, 0, 1) Resulting matrix: (2/(r-l), 0, 0, 0, 0, 2/(t-b), 0, 0, 0, 0, 2(f-n), 0, -(r+l/r-l), -(t+b/t-b), -(f+n/f-n)) Caveat: opengl takes the negative for n;f, therefore final matrix is: gluortho: (2/(r-l), 0, 0, 0, 0, 2/(t-b), 0, 0, 0, 0, -2(f-n), 0, -(r+l/r-l), -(t+b/t-b), -(f+n/f-n))

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents