SFTtech / openage

Free (as in freedom) open source clone of the Age of Empires II engine 🚀
http://openage.dev
Other
12.79k stars 1.13k forks source link

"`GL_INVALID_OPERATION`: Array object is not active" when rendering bufferless quad #1659

Open heinezen opened 4 months ago

heinezen commented 4 months ago

Description

OpenGL generates an error when a bufferless quad is drawn but no VAO is bound. This can happen in the renderer here (line 57):

https://github.com/SFTtech/openage/blob/29df8ac2a9ca164d52f27bbc05f7867ec0ba6560/libopenage/renderer/opengl/geometry.cpp#L56-L58

Even though glDrawArrays doesn't read from a buffer, it requires a VAO as stated in the OpenGL Wiki:

A non-zero Vertex Array Object must be bound (though no arrays have to be enabled, so it can be a freshly-created vertex array object).

How To Reproduce

  1. Create a GlGeometry object with a bufferless quad, e.g. with renderer::opengl::GlRenderer::add_bufferless_quad()
  2. Create a renderable with the geometry
  3. Add the renderable to a render pass
  4. Render the render pass and observe the error

Expected Behavior

An empty VAO should be created and bound when trying to render a bufferless quad.