有没有办法检查Android设备是否支持openGL ES 2.0?
我需要动态检查所使用的设备是否支持 openGL ES 2.0。 我怎样才能做到这一点?
I need to check dynamically if the used device supports openGL ES 2.0.
How can i do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
是的。以下代码可以解决这个问题:
阅读此内容以获取更多信息:
http://www.learnopengles.com/android-lesson-one-getting -started/
您可能还需要通过将以下内容添加到清单中来限制不支持 2.0 的设备在市场中看到您的应用程序:
另请参阅
uses-feature
<的文档/a>.Yes. The following code will do the trick:
Read this for more info:
http://www.learnopengles.com/android-lesson-one-getting-started/
You may also require want to restrict devices that don't support 2.0 from seeing your app in the marketplace by adding the following to your manifest:
See also the doc of
uses-feature
.除了以其他人提到的方式检查代码之外,如果您想将其限制在市场上仅适用于具有 2.0 的设备,则在清单中:
您应该同时执行这两项操作,我已经让人们将 apk 直接安装到不合适的设备上并且必须处理奇怪的异常。现在我抛出一个运行时间:
In addition to checking in code in the ways that others have mentioned, if you want to restrct it in market to ONLY those devices with 2.0 then in manifest:
You should do both, I've had people install the apk directly on to unsuitable devices and had to deal with strange exceptions. Now I throw a runTime:
确定 OpenGL 扩展:
OpenGL 的实现因 Android 设备支持的 OpenGL ES API 扩展而异。这些扩展包括纹理压缩,但通常还包括 OpenGL 功能集的其他扩展。
要确定特定设备支持哪些纹理压缩格式和其他 OpenGL 扩展:
在目标设备上运行以下代码以确定支持哪些纹理压缩格式:
警告:此调用的结果因设备而异!您必须在多个目标设备上运行此调用,以确定通常支持哪些压缩类型。
查看此方法的输出以确定设备支持哪些 OpenGL 扩展。
Determining OpenGL extensions :
Implementations of OpenGL vary by Android device in terms of the extensions to the OpenGL ES API that are supported. These extensions include texture compressions, but typically also include other extensions to the OpenGL feature set.
To determine what texture compression formats, and other OpenGL extensions, are supported on a particular device:
Run the following code on your target devices to determine what texture compression formats are supported:
Warning: The results of this call vary by device! You must run this call on several target devices to determine what compression types are commonly supported.
Review the output of this method to determine what OpenGL extensions are supported on the device.
您可以在您的代码中使用此代码:
You can use this code in your code:
从未使用过 OpenGL ES,但看到它具有与 OpenGL 相同的
glGetString
方法。它应该可以解决问题:http://www.khronos.org /opengles/sdk/docs/man/xhtml/glGetString.xml
Never used OpenGL ES, but saw it has the same
glGetString
method as OpenGL. It should do the trick:http://www.khronos.org/opengles/sdk/docs/man/xhtml/glGetString.xml
这段代码工作正常..
This code working Fine..
一段时间以来,我也一直在寻找同样的答案。但不幸的是,我找不到合适的描述。我刚刚自己找到了一个方法,我觉得我想与大家分享。
For a while, I've been looking for the same answer, too. But unfortunately, I couldn't find a proper description for that. I just found a way a minute ago by myself, and I feel like I'd like to share it with everyone.