1

The OpenGL 3.0 spec says:

E.1 Profiles and Deprecated Features of OpenGL 3.0

...

Client vertex arrays - all vertex array attribute pointers must refer to buffer objects (section 2.9.2). The default vertex array object (the name zero) is also deprecated. Calling VertexAttribPointer when no buffer object or no vertex array object is bound will generate an INVALID_OPERATION error, as will calling any array drawing command when no vertex array object is bound.

The ref page for glEnableVertexAttribArray says:

GL_INVALID_OPERATION is generated by glEnableVertexAttribArray and glDisableVertexAttribArray if no vertex array object is bound.

The message I'm hearing is that comprehensive vertex array code that's fully portable between OpenGL 2.x and OpenGL 3.x/3.2+ is impossible, since 2.x can't use VAOs (which the API surface can strictly enforce -- thanks GLAD!), and 3.x must use VAOs (which...some drivers maaaybe enforce?)

It seems to me that robust code must branch between dedicated 2.x and 3.x codepaths (detected at runtime) at some point. Is this true?

  • (I...am aware that this may be a time capsule of a question better suited for 2010 than 2020, but 2.x is of some importance to me here haha.) – The Most Curious Thing Jul 01 '20 at 20:41
  • You *can* just create & bind a VAO at startup & then forget it exists and proceed as if you were using a GL 2.x context, at least as far as vertex setup/submission goes. – genpfault Jul 02 '20 at 02:51

1 Answers1

1

When you use a compatibility profile OpenGL Context, then you can run the code of all previous OpenGL versions. Vertex array object 0 is valid and you can use fixed function attributes, immediate mode (glBegin/glEnd sequences) or even mix them all together.
Compare OpenGL 4.6 API Core Profile Specification and OpenGL 4.6 API Compatibility Profile Specification.

The specification of all OpenGL versions can be found at Khronos OpenGL registry.

Rabbid76
  • 202,892
  • 27
  • 131
  • 174
  • 1
    Ahhhhh, I completely misunderstood what the Compatability Profile entailed. I thought it was just to check that deprecated functionality was available, not provide different implementations of APIs. Thank you! – The Most Curious Thing Jul 01 '20 at 20:52