title: OpenGL ES 3.0 in Android NDK r9
body: <p>The recent Android NDK r9 unveils support of OpenGL ES 3.0. There is an example <code>samples/gles3jni</code> which demonstrates how to use OpenGL ES 3.0 from JNI/native code. The sample can be built two different ways:</p>
  
  <ul>
  <li>Compatible with API level 11 and later</li>
  <li>Require API level 18 or later.</li>
  </ul>
  
  <p>Both versions include an OpenGL ES 2.0 fallback path for devices that don't support OpenGL ES 3.0. However, the in the first case example is statically linked against OpenGL ES 2 using <code>LOCAL_LDLIBS</code> option <code>-lGLESv2</code>. In the second case it is statically linked with GLES 3 the same way.</p>
  
  <p>The initialization goes like this:</p>
  
  <pre><code>const char* versionStr = (const char*)glGetString(GL_VERSION);
  if (strstr(versionStr, "OpenGL ES 3.") &amp;&amp; gl3stubInit()) {
      g_renderer = createES3Renderer();
  } else if (strstr(versionStr, "OpenGL ES 2.")) {
      g_renderer = createES2Renderer();
  }
  </code></pre>
  
  <p>How can I omit the static linking at all and load GLES 2 or 3 dynamically from <code>.so</code>?</p>