简体   繁体   English

如何使用OpenGL扩展中的常量

[英]How to use constants from OpenGL Extensions

I want to use the extension GL_OES_texture_float for my Android OpenGL ES 2.0 app. 我想为我的Android OpenGL ES 2.0应用程序使用扩展名GL_OES_texture_float As is said here , at the khronos registries, the constants FLOAT , and HALF_FLOAT_OES are introduced. 至于说在这里 ,在Khronos的登记,常数FLOATHALF_FLOAT_OES介绍。 Can I just use these constants as I would any other ones? 我可以像使用其他常量一样使用这些常量吗? Or is there something else I must do before I can do this? 还是在执行此操作之前我还必须做其他事情?

Basically yes. 基本上是。 Of course you should first verify that the extension is supported on the device you're running on, by checking that it is contained in the string returned by glGetString(GL_EXTENSIONS) . 当然,您应该首先通过检查glGetString(GL_EXTENSIONS)返回的字符串中包含的扩展名,来验证所运行的设备是否支持该扩展名。

After that, the only slight challenge is that there are no Java bindings defined in the Android frameworks for a lot of extensions. 此后,唯一的挑战是,Android框架中没有为许多扩展定义Java绑定。 There is GLES11Ext , which contains definitions for some old extensions that already existed at the ES 1.1 time. GLES11Ext ,其中包含ES 1.1时已经存在的一些旧扩展的定义。 Then there is the much more recent GLES31Ext , which contains the definitions for the Android Extension Pack for ES 3.1. 然后是更新得多的GLES31Ext ,其中包含适用于ES 3.1的Android扩展包的定义。 But there's nothing in between, eg for common extensions to ES 2.0 and 3.0. 但是两者之间没有任何关系,例如对ES 2.0和3.0的通用扩展。

As long as you only need constants to use an extension, that's not a huge deal. 只要您只需要常量即可使用扩展名,那就没什么了不起。 You can look up the value in the extension specification, and define the symbolic constant in your own code. 您可以在扩展规范中查找值,并在自己的代码中定义符号常量。 It's more problematic for extension that require new entry points. 对于需要新的入口点的扩展来说,问题更大。 Then you almost have to use native code to access the features. 然后,您几乎必须使用本机代码来访问功能。

Unfortunately there's a history of missing features in the OpenGL Java bindings on Android. 不幸的是,Android上存在OpenGL Java绑定中缺少功能的历史。 For example, the ES 3.0 bindings are still incomplete, even though they were originally introduced in API level 18, and we reached API level 23 by now. 例如,尽管ES 3.0绑定最初是在API级别18中引入的,但仍不完整,而现在我们已达到API级别23。 Partly for this reason, you may want to consider using native code for serious OpenGL apps on Android. 部分由于这个原因,您可能要考虑对Android上的严肃OpenGL应用程序使用本机代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM