0

So what I'm trying to do is copy the current front buffer to a texture and use this during a resize to mimic what a normal window resize would do. I'm doing this because the scene is too expensive to render during a resize and I want to provide a fluid resize.

The texture coping is fine, but I'm struggling to work out the maths to get the texture to scale and translate appropriately (I know there will be borders visible when magnifying beyond the largest image dimension).

Can anyone help me?

cb4
  • 6,689
  • 7
  • 45
  • 57

1 Answers1

0

but I'm struggling to work out the maths to get the texture to scale and translate appropriately

Well, this depends on which axis you base your field of view on. If it's the vertical axis, then increasing the ratio width/height will inevitably lead to letterboxing left and right. Similar if your FOV is based on the horizontal axis inreasing height/width will letterbox top and bottom. If the aspect variation goes opposite you have no letterboxing, because you don't need additional picture information for this.

There's unfortunately no one-size-fits all solition for this. Either you live with some borders, or stretch your image without keeping the aspect, or before resizing the window you render with a largely bigger FOV to a quadratic texture of which you show only a subset.

datenwolf
  • 159,371
  • 13
  • 185
  • 298
  • I appreciate there will be borders, that's unavoidable. I'm trying to get an algorithm which achieves the best possible fidelity given the information available. – arbagan Jul 05 '12 at 13:03
  • Also I should mention I'd like to use the larger of the two dimensions to base the FOV on to minimise letterboxing. – arbagan Jul 05 '12 at 13:17