0
$\begingroup$

I have been developing a c++, openg, glfw3 and GLEW project on ubuntu and everything has worked so far. Recently I moved to a mac computer (chip M1 if it's important) and things stopped working.

I have an error on runtime when trying to call glGenVertexArrays. The error code is 1282 (0x0502) which according to khronos' wiki means:

GL_INVALID_OPERATION, 0x0502 Given when the set of state for a command is not legal for the parameters given to that command. It is also given for commands where combinations of parameters define what the legal parameters are.

I printed the OpenGL version with glGetString(GL_VERSION) and results in:

Version 2.1 Metal - 71.0.7

Then I tried running glewGetExtension("GL_ARB_vertex_array_object") which returns FALSE. I am not sure, to be honest, what exactly this means but I add it in case it's useful.

Is there any way of forcing my mac to run OpenGL in a compatible way with my source code? I thought about stop using vaos but I am also depending on a library that is supposedly only tested in windows and linux which maybe uses vaos as well. Also, I guess that I probably have problems with other things which don't yet get the chance to run since the program halts on this error.

To add up, my intention is to have a runnable program in linux and I don't intend on developing for mac. So running a VM with linux should solve the problem. Anyway, if there is a way to also make it work in my macos environment it would be much better.

$\endgroup$
1
  • 2
    $\begingroup$ Is OpenGL still a thing on M1 MacOS? Why does the version string cite "Metal"? Lastly, why is it GL 2.1? $\endgroup$ Commented Aug 5, 2021 at 3:12

1 Answer 1

1
$\begingroup$

OpenGL version 2.1 does not support vertex arrays (vaos), you need OpenGL version 3.0+. Try invoking a core profile and see if that helps. If not then your version might be maxed out at version 2.1 as Apple does not really support OpenGL well (And especially since your graphics card is directly vendored from Apple). Also a handy tip would to consider Apple's built in graphics API, Metal, because they have dedicated to supporting this graphics API.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.