# Why value 1 in OrthographicCamera viewPort width?

So, I read that camera = new OrthographicCamera(1, h/w); creates a camera with an appropriate width and height for the field view.. However, I can't understand that value 1 for the viewport width, does a value 1 means full width?

You need to distinguish between the gl-viewport and the cameras viewport. The GL-viewport somehow defines the area on the Display, while the cameras viewport defines the area in the game world.

So a camera with a viewport of (1/1) can see 1 unit of your world in width and height and projects it to the gl-viewport.

For example: You have a Camera with a viewport of (16,9) and it's center is at (8, 4.5), the middle. Now you can see all objects form P(0,0) to P(16,9). Objects outside this area are not visible to you.

You may ask, which values you should use. That depends on the game, but to find a good value, you may think about them like meters. How many meters of your gameworld you want to see at once? For example if you have a 1m tall character. How much space should he take on screen? If it's 1/9 of the screen, your viewport hight should be 9.
One important note: You should definitly use Viewports, they have some additional functions, which are usefull in many cases.

• I'm new to game dev so please don't judge me, I'm still kind of confused with all this concepts.. Tell me if I'm wrong.. We have our device display, what our viewport does is like selecting what part of our game world we see in the display, right? Also, our game world size isn't directly connected to the display size, right? It can be whatever the size we want for our game..
– yat0
May 7, 2015 at 22:55
• @polska Exactly. The camera just "selects" the part of your gameworld and projects it to the display. It is independend of the resolution and display size. The glViewport instead defines the "drawable" area on screen. May 8, 2015 at 6:04