View Full Version : Resizing
Hi!
I want to resize the backbuffer without zooming in or out. I mean, the rendered primitives should be the same size as before. I assume I have to change the view matrix, but how?
Reedbeta
11-23-2006, 10:38 AM
You mean you want them to be the same size in relation to the size of the screen, like changing screen resolutions? If that's the case, then you don't need to alter the view matrix at all. If you want them to be the same size in pixels, you'll need to reconstruct the view matrix with a smaller/larger field of view, proportional to the fraction by which you changed the size. You won't get pixel perfect accuracy but it will be close.
I want them to be the same size in pixels. I was thinking about changing the camera position (zooming in or out), but I dont know how to calculate the amount.
Reedbeta
11-23-2006, 06:53 PM
Don't move the camera. Just change the field of view. If for instance you increased the size of the back buffer by 5%, then increase the field of view by 5%.
(Note: technically what you need to do is increase the tangent of 1/2 of the field of view by 5%. But that takes some more complicated math to figure out, so for now just increase the field of view by 5%; it'll be approximately right.)
juhnu
11-23-2006, 07:45 PM
Or you could alter the projection matrix, by scaling it with the correct value. Scale it by 0.5 in case you are using 2 times bigger render target.
Reedbeta
11-23-2006, 08:20 PM
Juhnu: won't that also scale your near and far plane distances?
juhnu
11-23-2006, 10:21 PM
Reedbeta, yeah you are right. So..one should scale X and Y axis and leave Z as it was. That should work.
Ok thanks guys, I will give it a try.
vBulletin, Copyright ©2000-2010, Jelsoft Enterprises Ltd.