title: Android NDK C++ openGL ES 2 context gives bad display
body: <p>I am trying to implement a openGL ES 2.0 game using NDK in C++ . My test device was ASUS Zenphone 5
  I am pretty sure it supports openGL ES 2.0 as it can run games based on openGL ES 2 from play store very smoothly and also the helloGl2 sample in androind NDK.</p>
  
  <p>When I called <code>glCreateShader</code> log cat gave an error "called unimplemented api" by googling a bit I found out it was because the app was using openGL ES 1 context by default.</p>
  
  <p>So I modified the EGL context creation code from:</p>
  
  <pre><code>context = eglCreateContext(display, config, NULL, NULL);
  </code></pre>
  
  <p>to</p>
  
  <pre><code>EGLint contextAttrs[] = {
          EGL_CONTEXT_CLIENT_VERSION,2,EGL_NONE
  };
  
  context = eglCreateContext(display, config, NULL, contextAttrs);
  </code></pre>
  
  <p>Now this gave a different error</p>
  
  <pre><code> E/libEGL(12670): validate_display:257 error 3008 (EGL_BAD_DISPLAY)
  </code></pre>
  
  <p>However when I tested it on a galaxy s3 (GT-I9100) there was no BAD DISPLAY ERROR , but the app crashed on calling glCreateShader with fatal signal SIGSEV</p>
  
  <p>What is going on here?</p>