Well, i know there are plenty of different-sized screens in devices that run Android.

The SDK I code with deploys to all major desktop platforms and android. I am aware i must have special cares to handle the different screen sizes and densities, but i just had an idea that would work in theory, and my question is exactly about that method, How could it FAIL ?

So, what I do is to have an ortho camera of the same size for all devices, with possible tweaks, but anyway that would grant the proper positioning of all elements in all devices, right? We can assume everything is drawn in OpenGLES and input handling is converted to the proper camera coordinates.

If you need me to improve the question, please tell me.

  • \$\begingroup\$ I'm not clear on what you're trying to accomplish. What's the problem you're trying to solve? In terms of screen size and density, density is equivalent to resolution, and resolution is a more widely accepted term. \$\endgroup\$
    – House
    May 30, 2012 at 23:17
  • \$\begingroup\$ I am trying to achieve max portability between devices, without duplicate art, whenever possible. I agree, resolution is a better term! \$\endgroup\$
    – Grimshaw
    May 30, 2012 at 23:40
  • \$\begingroup\$ Possibly a duplicate or at least closely related to: gamedev.stackexchange.com/questions/51/… and gamedev.stackexchange.com/questions/18534/… \$\endgroup\$
    – House
    May 30, 2012 at 23:52

1 Answer 1


Your ortho camera handles the viewing frustum. Everything in the frustum will be projected to the viewport. What you are wanting to do is keep the frustum at a constant size, and change the size of the viewport (which is the correct way to do this).

[edit: The frustum is a 3D representation of space that defines the visible portion of your scene. Effectively a large rectangular prism, things inside get projected to the viewport, things outside do not.]

So, just make your viewport represent the size of your screen, and OpenGL ES will stretch the frustum however it needs to. Define all of your screen elements relative to the inside of the frustum.

On the note of duplicate art though, you really should try to provide one for each density; ldpi, mdpi, hdpi. Otherwise your game may look excessively stretched or shrunk. The extra assets can diminish this effect a bit.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .