0

Until now I realized that the viewport is a rectangle inside the camera and represents a portion of the camera that I want to see (correct me if I'm wrong). but I can not explain this:

I have this camera:

camera = new OrthographicCamera(10,10);
camera.translate(w/2, h/2);
camera.update();

If the camera' size is 10x10 Why can I set a viewport larger? for example:

camera.viewportHeight=Gdx.graphics.getHeight();
camera.viewportWidth=Gdx.graphics.getWidth();
camera.update();

Thank you for your time

cygery
  • 2,309
  • 3
  • 18
  • 25
  • Please check my answer here http://stackoverflow.com/questions/23491494/libgdx-what-is-a-viewport and the new `Viewport` class (https://github.com/libgdx/libgdx/wiki/Viewports) – noone Aug 09 '14 at 13:06
  • ok I understood the thing. Thank you! – user3904861 Aug 11 '14 at 23:42

1 Answers1

-1

No, the viewport is not a portion of the camera:

The viewport is a rectangular viewing region of the SCREEN where the 3D scene is projected. It is nothing more than mapping the 3 dimensional objects to the 2 dimensional plane.

Check this very good article:

https://github.com/libgdx/libgdx/wiki/Screen-%26-viewport

Ocfmem
  • 356
  • 1
  • 7
  • Imo this does not really explain it very well. There are several different meanings of "viewport" actually. This article is old. – noone Aug 09 '14 at 13:07