CS 455 Lecture 11 – Aspect Ratio
Agenda
- what ?s
- Playdoh projection
- fitting the projection to the viewport
TODO
- Start the Magnets homework.
- No class on Thursday.
- Some of you have missed some lab checkpoints and have asked if they could still be submitted. I’m am reluctant to diminish the value of previously awarded checkpoints. However, I offer the following two checkpoints for extra credit:
- Investigate a shear transformation. Write a matrix routine to generate one. Apply the transform to a model and send me an email screenshot.
- Load two models into one scene. Use the same shader program, but create two vertex array objects.
- As a lab exercise, expand your model renderer in the following manner:
- Right now, you probably hardcode the dimensions of the chunk of the world you are viewing when you establish your projection matrix. But what if you get a really big model? Instead, size the chunk of the world that you view according to the model being visualized. If the farthest point on the model from the origin is (a, b, c), then set the chunk’s width, height, and depth according to the length of (a, b, c). I’ve placed a larger
castle.obj
in themodels
directory of the repository. - Right now, when you resize the window, the model gets distorted. Adjust the dimensions of the world chunk you project into the viewport according to the viewport’s aspect ratio.
BaseRenderer::GetAspectRatio
will tell you the window’s aspect ratio. You could make your projection viewport-sensitive in eitherOnDraw
(called once per frame) orOnSizeChanged(int width, int height)
(called once per resize event).
- Right now, you probably hardcode the dimensions of the chunk of the world you are viewing when you establish your projection matrix. But what if you get a really big model? Instead, size the chunk of the world that you view according to the model being visualized. If the farthest point on the model from the origin is (a, b, c), then set the chunk’s width, height, and depth according to the length of (a, b, c). I’ve placed a larger
Haiku
on the limits of viewports
Group photos are bad
Let’s average the faces
Not shrink them all down
Group photos are bad
Let’s average the faces
Not shrink them all down