Hi, can anyone give an advice on how to scale Sprites or Textures when window resolution is changed?
I am using glOrtho(); in OpenGL, and I have my original sprites about 90% larder in size originally, when i render them
in my test window, which is 800x600, i Scale them down to 10% of the size so they look nice in s small window, which they do.
I was wondering, when there is a 2D glOrtho set up, how should i go about scaling the sprites when changing the resolution?
Is it really done in 2D games? Or should, whoever has higher resolution, see more of the world (map)?
At the moment, i have tried one trick, my lowest resolution is 800 x
At this resolution sprites are scaled down to 10% of the original size.
When i change the resolution, i re-calculate Scalar, and re-scale sprites according to this new Scalar variable.
// As a minimum res will be 800x600; float Scalar = getScreenWidth() / 800; // 800 width = 10% of the original size. resScalar = -(90 / resScalar); // Scale the ship sprite ship->Scale(resScalar);
Here it is at 800x600:
Here it is at 1920x1200
So as you can see, it kind works good.
\ I was wondering, how would you go about background textures?
If we are talking about Tile Based approach? If tiles are fixed size, you cant re-scale textures in them? right?*
\ And one other thing, what resolution should all the sprites be? All in the same resolution which is much bigger then they appear
in the game, so they can be scaled up and down in game as i need ?*
Please, whoever did that before, could you give some advice on what to do with the sprites (textures) when resolution
has been changed. Thanks.