I’ve been using glDrawArrays to render triangles that cover the whole screen by generating the vertex positions in the vertex shader using gl_VertexID (as done in the FXAA whitepaper http://developer.download.nvidia.com/assets/gamedev/files/sdk/11/FXAA_WhitePaper.pdf).
// drawcall, no VAO bound
glDrawArrays( GL_TRIANGLES, 0, 3 );
// vertex shader
out vec2 vTexCoord;
void main()
{
vTexCoord = vec2( (gl_VertexID << 1) & 2, gl_VertexID & 2 );
gl_Position = vec4( vTexCoord * 2.0 - 1.0, 0.0, 1.0 );
}
This happens to work fine in a normal OpenGL context, glGetError() reports GL_NO_ERROR as expected.
But i get the following error when using a debug context with debug output:
“GL_INVALID_OPERATION error generated. Array object is not active.”
Is this a driver bug?
I didn’t get any errors under DX11 and the glDrawArrays documentation doesn’t mention any GL_INVALID_OPERATION errors for inactive VAOs (http://www.opengl.org/sdk/docs/man/xhtml/glDrawArrays.xml).