获取OpenGL最大纹理大小 [英] Get OpenGL max texture size

查看:1856
本文介绍了获取OpenGL最大纹理大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个可广泛用于位图的Android应用,我正在寻找一种可靠的方法来在不同设备上获得OpenGL的最大纹理大小.
我知道最小尺寸= 2048x2048,但这还不够好,因为那里已经有分辨率更高的平板电脑(例如2560x1600)
那么,有没有一种可靠的方法来获取此信息?

到目前为止,我已经尝试过:

I'm developing an Android app that's going to work with bitmaps extensively and I'm looking for a reliable way to get the maximum texture size for OpenGL on different devices.
I know the minimum size = 2048x2048, but that's not good enough since there are already tablets out there with much higher resolutions (2560x1600 for example)
So is there a reliable way to get this information?

So far I've tried:

  • Canvas.getMaximumBitmapWidth()(返回32766,而不是2048)
  • GLES10.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE ...)(返回0)

我正在使用最低SDK = 15(ICS),并正在Asus Transformer TF700t Infinity上对其进行测试

I'm working with minimum-sdk = 15 (ICS) and I'm testing it on a Asus Transformer TF700t Infinity

有人知道另一种获取方式吗? 还是我必须编译其最大画布大小的已知GPU列表?

Does anyone know another way to get it? Or will I have to compile a list of known GPUs with their max canvas size?

推荐答案

尝试使用此代码

int[] maxTextureSize = new int[1];
GLES10.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0);

maxTextureSize存储已解码图像的大小限制,例如4096x4096、8192x8192.请记住在 MainThread 中运行这段代码,否则您将得到零.

maxTextureSize stores the size limit for decoded image such as 4096x4096, 8192x8192 . Remember to run this piece of code in the MainThread or you will get Zero.

这篇关于获取OpenGL最大纹理大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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