在Android设备上控制显示刷新率 [英] Controlling Display Refresh Rate on Android Device

查看:80
本文介绍了在Android设备上控制显示刷新率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

还不是开发人员,只是试图找出android应用程序是否可以满足我的需求.

Not yet a developer, just trying to find out if an android app can do what I need..

我需要什么:

一个简单的应用程序,它以固定的频率以一定的强度在屏幕上显示单色的全帧!我需要它用于具有尽可能高的分辨率的同步目的(通过以已知的模式以尽可能高的固定频率来改变强度来实现).

Simple app that displays a full frame of a single color onscreen at a certain intensity at a fixed frequency! I need it for a synchronization purpose with as high a resolution as possible (achieved by changing an intensity in a known pattern with as high a fixed frequency as possible).

我有什么问题:

  1. 使用以下命令运行的android设备是否固定的显示频率或是否存在任何方式将其设置为固定例如60fps的频率?

  1. Does an android device run with a fixed display frequency or is there any way to set it to a fixed frequency of say 60fps?

如果固定频率可以实现,有没有vsync中断或类似的东西让我更改屏幕上的强度在适当的时候.

If the fixed frequency can be achieved, is there a vsync interrupt or something similar that lets me change the intensity on the screen at the right time.

如果以上两种情况都可以实现了,我需要哪种方法采取.我在想我要看在OpenGL ES或NDK上...有人可以指出我的意思吗正确的方向....

If the above two things can be achieved, which approach do I need to take. I'm thinking I need to look at OpenGL ES and perhaps NDK.... Could anyone please point me in the right direction....

推荐答案

我希望刷新率固定在硬件或显示驱动程序级别.有用于找出它是什么的API ,但我对此表示怀疑如果可以设置的话.

I would expect the refresh rate to be fixed at hardware or display driver level. There is an API for finding out what it is, but I doubt if you can set it.

我写了一款实现40fps固定帧速率的游戏.基本技术是将所有内容绘制到屏幕外的缓冲区中……这是GL自动发生的,但是如果使用Canvas,则必须手动完成.

I wrote a game which implemented a fixed framerate of 40fps. The basic technique was to draw everything to an off-screen buffer... something which happens automatically with GL but which has to be done by hand if using Canvas.

完成在屏幕外绘制场景的昂贵且可变长的工作后,您可以阻止渲染线程(或执行其他工作),直到可以进行渲染为止.这样做将确保每个帧均以均匀的间隔显示.这样可以使您获得顺畅的运动,并获得了额外的好处,即不会因绘制过多而消耗电池电量(很多基于GL的应用确实会因为没有充分的理由而使用RENDERMODE_CONTINUOUSLY.)

When the expensive and variable-length work of drawing your scene off-screen is completed, you can then block your rendering thread (or do other work) until it's time to render. Doing this will ensure each frame displays at even intervals. This gets you nice smooth motion with the bonus that you're not burning your battery by drawing too much (something a lot of GL-based apps do cos they use RENDERMODE_CONTINUOUSLY for no good reason).

这篇关于在Android设备上控制显示刷新率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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