title: OpenGL ES2.0 glTexImage2D() returns GL_INVALID_VALUE
body: <p>I have a problem trying to generate a texture (for a font atlas) on one of my Android devices (Samsung N5100 tablet). The below code works fine on iOS and on my Samsung S4.</p>
  
  <p>glTextImage2D() keeps returning GL_INVALID_VALUE.</p>
  
  <p>At first I thought it was a power of 2 issue but I've tried hardcoding various power of 2 values and it continues to fail. GL_MAX_TEXTURE_SIZE returns a value of 4096 but I can't even get 16x16 to work.</p>
  
  <pre><code>  glActiveTexture( GL_TEXTURE0 );
    glGenTextures( 1, &amp;m_TextureAtlasStrip );
    glBindTexture( GL_TEXTURE_2D, m_TextureAtlasStrip );
    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
    glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
  
    if( CheckGLError() )
      LogDebugf( "FAIL(9)" );
  
    GLint f = 0;
    glGetIntegerv( GL_MAX_TEXTURE_SIZE, &amp;f );
    LogDebugf( "GL_MAX_TEXTURE_SIZE: %d", f );
  
    if( CheckGLError() )
      LogDebugf( "FAIL(9F)" );
  
  //nPow2RoundWidth = 2048;
  //nPow2RoundWidth  = 1024;
  //nPow2RoundWidth  = 512;
  nPow2RoundWidth  = 16;
  nPow2RoundHeight = 16;
  LogDebugf( "nPow2RoundWidth: %d  nPow2RoundHeight: %d", nPow2RoundWidth, nPow2RoundHeight );
  
    glTexImage2D( GL_TEXTURE_2D, 0, GL_RED, nPow2RoundWidth, nPow2RoundHeight, 0, GL_RED, GL_UNSIGNED_BYTE, 0 );
  
    if( CheckGLError() )
    {
      LogDebugf( "AT FAIL(10)" );
      exit( 1 );
    }
  
    LogDebugf( "WORKED AT (10)" );
    exit( 1 );
  </code></pre>
  
  <p>What would cause this? </p>
  
  <p>UPDATE:
  If I change GL_RED to GL_RGB it works..</p>
  
  <pre><code>glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, nPow2RoundWidth, nPow2RoundHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, 0 );
  </code></pre>