使用NativeActivity硬件缩放OpenGL表面 [英] Hardware scaling the OpenGL surface with NativeActivity

查看:146
本文介绍了使用NativeActivity硬件缩放OpenGL表面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在尝试在本机屏幕尺寸为1080p的设备上运行复杂的OpenGL应用程序.不幸的是,该设备的3D芯片组在这种尺寸的帧速率下还不够好.

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.

我们更愿意做的是以720p(或更小)的渲染速度,然后进行硬件加速的放大以填充屏幕.

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

我知道Android可以自动处理2D内容(使用ANativeWindow_lock()和朋友).有没有办法对3D内容自动执行此操作?

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?

推荐答案

对于GLSurfaceView,请使用:

For a GLSurfaceView, use:

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

对于NativeActivity,请使用:

For a NativeActivity, use:

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

在以下博客文章中找到了此内容:

Found this in following blogpost:

Android开发者博客-使用硬件缩放器,以提高性能和效率

这篇关于使用NativeActivity硬件缩放OpenGL表面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆