title: LibGDX - Sprite / Pixmap / Camera / ViewPort sizes (width/height ) - algorithm of all size transformations from PixMap to (physical device) Screen
body: <p><strong>What is my <em>complete</em> thinking algorithm to understand all possible width/height transformations on the path</strong> <code>PixMap -&gt; (physical) Screen/monitor</code>?</p>
  
  <p>Sorry for the stupid question, but how do these sizes corellate / scale / interact?</p>
  
  <p>What size do I actually see on the screen and what scaling effects happen?</p>
  
  <p>I need a quick-start, but googling does not yield direct and systematic answers.</p>
  
  <p><code>PixMap</code> is a picture/image (from a file or some programmatically drawn primitive) with its width/height <strong><em>in pixels</em>.</strong></p>
  
  <p>Later on this PixMap will be shown on the physical Screen of some physical device. As I understand, actually it will be shown only in the part of the physical device screen - only within my game's application window (<code>config.width / config.height</code> in <code>LwjglApplicationConfiguration</code>) - I guess it is in pixels...</p>
  
  <p><code>PixMap</code> is wrapped into <code>Texture</code> (I don't fully understand why - OpenGL says Texture is a container for one or more images, but new <code>Texture(PixMap)</code> takes only a single PixMap). <code>Texture</code> does not have any sizes (OK, it is just a container for PixMap(s).</p>
  
  <p>Now <code>Texture</code> is wrapped into <code>Sprite</code> (<code>new Sprite(Texture)</code>). Sprite has its own width/height. Sprite is some visible part of my game (moving robot, ball, tank, missile, etc). So Sprite size overrides PixMap size and therefore shall cause scaling somehow?</p>
  
  <p>But <em>is Sprite size what I actually see on the screen</em> (if I never called <code>sprite.scale()</code>)? <code>sprite.setSize(float, float)</code> - means height/width in pixels???  Can Sprite automatically set size exactly to be the same as the underlying PixMap?</p>
  
  <p>Now <code>Camera</code> size - Camera is what the user actually sees on screen (part of the Game World which might be larger than screen), right? So I can set Camera size equal to Gdx Application Window (config.width / config.height in Launcher class)? Or Camera size defines visible (displayed to the user) part of the physical screen? If my game fits the whole of the screen, I can set Camera size to be equal to screen size and that's all. Why do I need Camera? I think I fail to understand Camera completely. </p>
  
  <p>And <code>ViewPort</code> - it is "same" as Camera (it manages Camera). But I see that ExtendViewPort and ScalingViewPort "tamper" with scaling, so they resize my Sprite/PixMap/Camera sizes? </p>
  
  <p>Besides, all <code>ViewPort</code> classes have <code>minHeight/minWidth</code> in their constructors - another size transformation / scaling?</p>
  
  <p>P.S. Another issue is coordinates in all those cases. What relative to what?</p>
  
  <p>This <a href="https://stackoverflow.com/questions/40059360/difference-between-viewport-and-camera-in-libgdx">answer</a> is also partially related and helpful.</p>