简体   繁体   中英

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. As is said here , at the khronos registries, the constants FLOAT , and HALF_FLOAT_OES are introduced. 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) .

After that, the only slight challenge is that there are no Java bindings defined in the Android frameworks for a lot of extensions. There is GLES11Ext , which contains definitions for some old extensions that already existed at the ES 1.1 time. Then there is the much more recent GLES31Ext , which contains the definitions for the Android Extension Pack for ES 3.1. But there's nothing in between, eg for common extensions to ES 2.0 and 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. 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. Partly for this reason, you may want to consider using native code for serious OpenGL apps on Android.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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