# Why do we have to resize the screen in LibGDX

In a lot of the libgdx tutorials that I have took until now, I am told to resize the screen of the game using the SetToOrtho() of the orthographic camera. However, I don't get this part. Why do I have to resize the screen and make the sprites look bigger when I can just make the sprites themselves big at the first place?

• Just a ballpark guess: it is more efficient then having the user manually resize the sprites. – JDSweetBeat Feb 7 '17 at 16:17

## 1 Answer

You're not actually "resizing the screen" with setToOrtho. You're building an orthographic projection matrix that takes into account the size of the screen (note the source).

By doing this, you effectively map the world coordinates of your sprites to pixel coordinates on the screen, which lets you work more naturally in terms of pixel positioning and pixel sizes.

• Oh ok thank you for the answer. That makes sense!But this makes me ask another question... An orthographic projection matrix is basically a means of representing a three-dimensional object in two dimensions right? Then why did the tutorial use orthographic projection at the first place when the sprites are already in 2D. (The sprites were flat images) – chanu19 Feb 7 '17 at 16:38
• All projections (we use in computer graphics) are ways of transforming and representing 3D geometry in 2D. An orthographic projection is a parallel projection where all projected lines are orthogonal to the plane of projection; in particular it is not a perspective projection and doesn't have that perspective effect of things getting smaller as they are "further" from you. This makes it useful for 2D work. – user1430 Feb 7 '17 at 17:06
• Your sprite textures are 2D, but the geometry you draw those textures with is 3D; the underlying graphics API used by libgdx (OpenGL, etc) is a 3D graphics API. – user1430 Feb 7 '17 at 17:07
• Ohhh, I never knew that the underlying graphics used by libgdx is 3D and that we change it 2D to render it to the screen. Now it is so clear, Why couldn't the tutorials tell me that :( – chanu19 Feb 8 '17 at 4:52