Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question
    
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. –  Byte56 May 30 '12 at 23:17
    
I am trying to achieve max portability between devices, without duplicate art, whenever possible. I agree, resolution is a better term! –  Grimshaw May 30 '12 at 23:40
    
Possibly a duplicate or at least closely related to: gamedev.stackexchange.com/questions/51/… and gamedev.stackexchange.com/questions/18534/… –  Byte56 May 30 '12 at 23:52
add comment

1 Answer

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.