0

We're trying to run a complex OpenGL app on a device whose native screen size is 1080p. Unfortunately, the device's 3D chipset isn't really good enough for a decent frame rate at this size.

What we'd much prefer to do is the render at 720p (or less) and then do hardware accelerated upscaling to fill the screen.

I know Android can do this automatically with 2D content (using ANativeWindow_lock() and friends). Is there any way to do this automatically for 3D content as well?

David Given
  • 13,277
  • 9
  • 76
  • 123
  • Would rendering to smaller sized FBO - and then rendering its contents to full screen do the trick for you? – harism Jan 14 '13 at 08:07
  • Yes, but I'd really like to avoid that if possible --- off-screen surfaces on Android are a mess: http://blog.vlad1.com/2010/07/01/how-to-go-mad-while-trying-to-render-to-a-texture/ It would explode into a million different hard-to-test code paths. Hence my desire for a built-in mechanism... – David Given Jan 14 '13 at 11:06
  • I've been using FBOs many times and never found any problems with them. In any case, they're the only way to render at smaller resolution AFAIK. Using FBOs adds only FBO creation code - rendering to FBO - and copying FBO to screen buffer after all. Shouldn't there be much logics involved that made testing any harder than without FBO. – harism Jan 14 '13 at 11:10
  • I would suggest FBO also. IMHO it will be the best solution for your problem. One trick - create FBO in RGBA format - apparently RGB FBO are not supported on some hardware - galaxy s2 with Mali. Also remember about context being lost when application goes into background - you will have to recreate FBO when application resumes. – Wojciech Jan 15 '13 at 08:55
  • Unfortunately FBOs aren't appropriate here --- I'm not allowed to add stuff to the app's GL context, and instead have to create a new one; so it's going to have to be pbuffers. Which is why I would like to avoid the whole issue completely... and regarding losing the context, you would not _believe_ how much code we have to deal with that. Sometimes it even works. – David Given Jan 15 '13 at 10:10

1 Answers1

1

For a GLSurfaceView, use:

surfaceView = new GLSurfaceView(this);
surfaceView.getHolder().setFixedSize(1280, 720);

For a NativeActivity, use:

int32_t ret = ANativeWindow_setBuffersGeometry(window, 1280, 720, 0);

Found this in following blogpost:

Android Developers Blog - Using the Hardware Scaler for Performance and Efficiency