Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

AndroidGameView - Resolution Scaling?

In short, I want to configure our AndroidGameView to be:

  • 1200 x 1920 pixels on the actual screen (this is my full screen native resolution)...
  • but I want the OpenGL ScreenBuffer resolution to only be smaller, 800x1280 pixels.

I want the Android Game View to be full screen, but rendering a Screen Buffer that is lower resolution, and stretch the pixels for me.

Any help would be greatly appreciated! Thanks!

-- Background --

We have an application which requires a fixed pixel resolution. We get around this on the normal 2D forms by employing a full-form picture box, and then use an image of the appropriate fixed-size. Then Android blits it to the real-screen magically for us, stretching pixels cleanly/automatically.

Now we are employing a popup form that uses OpenGL to render a 3D scene. Again, we'd like for this form to stretch pixels in the same fashion.

What I am wanting is a way to tell AndroidGameView to scale it's pixels in same fashion. In short, I want the OpenGL ScreenBuffer to be a fixed-pixel size, but I want the AndroidGameView to be "full screen screen".

For example, I develop on a Nexus7(2013) which has resolution 1200 x 1920 pixels. But our application employs a smaller fixed resolution of 800x1280 (most for performance reasons). This way the form can still be full width, but our pixel shaders only need to process about 44% as many pixels -- and so it runs faster. Additionally, the size of everything on the screen turns out to be fixed size as well (e.g. projected grid lines on the terrain, are too narrow otherwise).

This type of stretching is the norm for games (e.g. you might have an HD monitor at 1920x1080 pixels, but you want your game to render lower resolution as 960x540, perhaps, for sake of speed). What I'm trying to do is a very normal thing, but I can't find any documentation that tells me how to easily accomplish this.

NOTE: I already realize that I could do a Render-to-Bitmap technique, and stretch the bitmap result in a Picture Box -- but I'd like to avoid the extra cost of doing this (and it's awkward). I figure the AndroidGameView supports this technique more cleanly, somehow.

Sign In or Register to comment.