graphics - LIBGDX: What is a "viewport"? -


This post related to a previous post to learn how to properly submit between LIBGDX and Box2D. I have to understand the viewport very well before moving forward. After more code / post reading, I thought "viewport" meant to open the rectangle of the camera lens, which looks at the game world of LIBGDX, where I can go to see the world to see what I want " . But, after reading more, I did not have to go anywhere near the real meaning.
I have read LIBGDX Wiki, and have read in the OpenGL documentation, which explain the viewport as two separate things.

LIBGDX Wiki:

"The viewport is a rectangular viewing area of ​​the screen, where 3D visualization is estimated, nothing more than mapping 3 dimensional objects. 2-dimensional plane. "

OpenGL:

" Viewport shows the size of the available screen area in which the view is mapped. "

Stack overflow:

"... there are several definitions in different contexts ...": (

I have tried to read the stage post and tens of tutorials. But, unfortunately, almost all jump in it like "Viewport" is such an ancient concept that everyone understands and knows.
I Know that I will get lots of heat, please do not flame for this completely basic question, I I am asking because I do not really know and really need help.

Still, in the real question.

What is the "viewport" in the LIBGDX context? P>

It depends on the version of LibGDX you are using.

Manage things:

  • Viewport
  • Open GL Viewport

Viewport of a camera fixed how many of your game world To see If you have a large TiledMap size of 10000px x 10000px, you probably want to show only a small area of ​​that map at a time. If you define your camera viewport as 800 pixels x 480 pix, then you will see a portion of your map, which in reality is this dimension (at least one in the case of orthographicCamera ). It's like a window through which you see your world and you define it as size through a viewport.

The OpenGL viewport defines the area in which the camera view should be mapped. By default the viewport is 100% of the size of your window on the desktop operating system. But it may also be different with a FitViewport with LibGDX 1.0.0 that can scale the viewport so that it defines the aspect ratio of the "virtual viewport" that you define (which is actually The camera has a viewport, which is the viewport class). This means that the aspect ratio of the window does not match the aspect ratio of the viewport (virtual) aspect, the open GL viewport will be set for a small size and black bars will be visible. So you can think of it as another layer between the actual window and the camera on your desktop. This layer takes the output of your camera and scales according to the size defined in your desktop window.


Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -