Detect if resolution is too high on Android Lollipop

…衆ロ難τιáo~ 提交于 2019-12-04 20:37:11

That GL query requires an active GL context on the thread. Previously your app was accidentally using framework's private GL context to perform that query. In Lollipop due to various architecture changes this context no longer leaks into application code, hence why the query is now failing. If you look in logcat you will probably see something like: "call to opengl es api with no current context".

You can create your own GL context to perform that query if you want. Alternatively you can assume the screen resolution is the maximum, or use a scalable solution such as a tiled approach.

Technically you're only guaranteed to be able to render single bitmaps that are the size of the screen or smaller. You might be able to render bigger ones on some hardware, but it is unpredictable -- and as I said, the only actual guarantee is that you will be able to render something the size of the screen (or smaller).

To display bigger images, split up your UI into tiles, each of which is no bigger than the screen in either dimension.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!