Access OpenGL ES extensions in Android 2.2 and early

One big issue with versions 2.2 and below of Android is that you cannot query extension’s methods from OpenGL ES.

But there’s a simple hack I tested in my LG Optimus 2x:

  1. in /system/lib/egl directory, there’s a library called Open it with dlopen method in NDK:
    void* eglLibrary = dlopen(“”);
  2. query for method eglGetProcAddress with dlsym method. Hopefully, you’ll obtain a valid address:
    typedef void* (*PFNEGLGETPROCADDRESS)(const char* procName);
    PFNEGLGETPROCADDRESS getProcAddress = (PFNEGLGETPROCADDRESS) dlsym(eglLibrary, “eglGetProcAddress”);

  3. Now, query OGLES extension methods normally:
    typedef void (*PFNGLCOVERAGEMASKNV)(GLboolean mask); 
    PFNGLCOVERAGEMASKNV glCoverageMaskNV = (PFNGLCOVERAGEMASKNV) getProcAddress(“glCoverageMaskNV”);
  4. Don’t forget to close the library at the end of the program:

Other devices must be similar libraries in the same directory. I’ll post some updates about this.

This entry was posted in OpenGL ES 2.0 and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s