Compatibility between OpenGL ES 3.0 and Desktop

I am attempting to update a game engine I made from OpenGL ES 2.0 to 3.0. I believe I have completed this process and it seems to work great on mobile, but when working internally, we had normally used OpenGL Desktop on Mac (gl.version: 4.1 Metal - 88.1)

It seems to be getting hung up on this line:

        glVertexAttribPointer(offset, TEXTURE_COMPONENT_COUNT, GL_FLOAT, GL_FALSE, TOTAL_SIZE, data);
        CM_GL_CHECKERROR();
        glEnableVertexAttribArray(offset);

From my reading, it seems like the Desktop version is now expecting you to create a base Vertex Array Object whereas ES has it automatically.

However, when I attempt to do this, it does not work (and also breaks the ES version)

    glGenVertexArrays(1, &VertexArrayObject);
    glBindVertexArray(VertexArrayObject);

I am doing this creation when I create the OpenGL manager object in my engine, so it is not occuriing every frame, but I am attempting to bind it every frame.

Of note, on Desktop, both the glVertexAttribPointer and glGenVertexArrays both give an OpenGL error code of 0x0502.

Any suggestions would be very much appreciated!

This is GL_INVALID_OPERATION (0x0502).

Ok, first. This is Apple Mac. They’ve stated their lack of support for OpenGL. So take whatever you observe on this platform with a pound of salt. Results on a desktop PC with an NVIDIA GPU+drivers might net you much more dependable results.

Second, are you absolutely certain that no GL error was posted “before” the GL calls that you think triggered one. Add a glGetError() before these calls to be sure. Part of why I suggest this is that, on Mac, sometimes the context init is actually what throws the GL error. For instance:

Also, found 2 reports on gpuinfo.org with similar GL_VERSION reports to yours (both with GL_RENDERER = Apple M1 Max):

Seems a bit odd that these 2 OpenGL 4.1 Core driver reports don’t support ARB_vertex_array_object, when I believe VAOs were accepted into core in OpenGL 3.0.

If I were you, I’d try your desktop testing on something other than a Mac. For instance, a PC with an NVIDIA GPU+driver.

Thank you for the suggestions. I had already put error checking everywhere to narrow down the exact line

    CM_GL_CHECKERROR();
    setFullScreenViewport();
    CM_GL_CHECKERROR();
    glGenVertexArrays(1, &VertexArrayObject);
    CM_GL_CHECKERROR();
    glBindVertexArray(VertexArrayObject);
    CM_GL_CHECKERROR();

This Mac version is just for our artists and programmers to be able to do their development in the desktop, so unfortunately, I need to get it working on the poorly supported M series chips.

Does your CM_GL_CHECKERROR function call glGetError repeatedly until it returns GL_NO_ERROR? Or does it just call glGetError once? It should be the former; an implementation is allowed to store multiple errors.

GL_INVALID_OPERATION (0x0502) isn’t an allowed error for glGenVertexArrays; the only allowed error is GL_INVALID_VALUE if you request a negative number of arrays. So this error being reported for glGenVertexArrays is more likely to be an issue with the error reporting code (either yours or the implementation’s).