title: Getting error "No Vertex attrib is enabled in draw call" on glDrawElements
body: <p>I'm working on an Android app that uses OpenGL ES 2.0. When I try to render my primitives from the array data with the following line...</p>
  
  <pre><code>// primitiveType is a GLenum with a value of 1
  // batch-&gt;GetIndexCount() returns a size_t with a value of 65528
  // indexType is a GLenum with a value of 5123
  // Passing 0 as the indices parameter since an ELEMENT_ARRAY_BUFFER is bound (0 will be treated as an offset within the buffer)
  GL_CHECK(glDrawElements(primitiveType, static_cast&lt;GLsizei&gt;(batch-&gt;GetIndexCount()), indexType, 0));
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>I/Adreno-ES20: &lt;validate_vertex_attrib_state:55&gt;: validate_vertex_attrib_state: No vertex attrib is enabled in a draw call!
  W/Adreno-ES20: &lt;core_glDrawElementsInstancedXXX:1014&gt;: GL_INVALID_VALUE
  D/libEGL: [glDrawElements] 0x501
  D/glGetError:glDrawElements: #00 pc 00002a31  /system/lib/libbacktrace.so (Backtrace::Unwind(unsigned int, ucontext*)+8)
  D/glGetError:glDrawElements: #01 pc 0000ba41  /system/lib/libutils.so (android::CallStack::update(int, int)+52)
  D/glGetError:glDrawElements: #02 pc 00025ff5  /system/lib/libEGL.so
  D/glGetError:glDrawElements: #03 pc 000cea14  /data/app/com.sample.openglesapp/lib/arm/libgl_code.so (OpenGLESHelper::DrawBatch(OpenGLESApp::Graphics::PrimitiveBatch*)+720)
  D/glGetError:glDrawElements: #04 pc 00129038  /data/app/com.sample.openglesapp/lib/arm/libgl_code.so (RendererOpenGLES::Render_DrawBatch(OpenGLESApp::Graphics::PrimitiveBatch*)+52)
  D/glGetError:glDrawElements: #05 pc 000d4b80  /data/app/com.sample.openglesapp/lib/arm/libgl_code.so (OpenGLESApp::Graphics::RendererBase&lt;OpenGLESApp::Graphics::Rendering3D::Camera&gt;::Render()+532)
  D/glGetError:glDrawElements: #06 pc 00161bd8  /data/app/com.sample.openglesapp/lib/arm/libgl_code.so (RenderFrame()+344)
  D/glGetError:glDrawElements: #07 pc 00161cc0  /data/app/com.sample.openglesapp/lib/arm/libgl_code.so (Java_com_sample_openglesapp_GL2JNILib_step+20)
  D/glGetError:glDrawElements: #08 pc 000db0e1  /data/dalvik-cache/arm/data@app@com.sample.openglesapp@base.apk@classes.dex
  </code></pre>
  
  <p>According to the OpenGL ES 2.0 documentation, <a href="https://www.khronos.org/opengles/sdk/docs/man/xhtml/glDrawElements.xml" rel="nofollow noreferrer">glDrawElements returns a GL_INVALID_VALUE error code</a> when the count (second parameter) is negative, which is not the case here. Also, the vertex attributes are enabled.
  What else could be causing this issue?</p>