SFML community forums

Help => Graphics => Topic started by: SpacedCowboy on September 12, 2020, 12:53:02 am

Title: glGenVertexArrays on the Mac
Post by: SpacedCowboy on September 12, 2020, 12:53:02 am
Not sure if this is an SFML thing or not, but on the Mac I needed to alter <SFML/OpenGL.hpp> to read as


#elif defined(SFML_SYSTEM_MACOS)

    #include <OpenGL/gl3.h>
 


... note the 'gl3.h' part, not the original 'gl.h'. Without this, Xcode won't find glGenVertexArrays() it gives instead:

Use of undeclared identifier 'glGenVertexArrays'; did you mean 'glGenVertexArraysAPPLE'?
 


This is using the SFML install from homebrew (2.5.1)


[edit: never mind. I hadn't realized that GLEW was pretty much essential for the extensions etc., and GLEW wants to include <OpenGL/gl.h>, and it's not a good idea to include both...

So, once GLEW is included and init'd, the call to glGenVertexArrays works fine.

I tried to delete this post, but I can't, hence the edit]
Title: Re: glGenVertexArrays on the Mac
Post by: eXpl0it3r on September 16, 2020, 08:04:16 am
SFML only exposes the OpenGL symbols that it uses itself.
GLEW is a relatively outdated way to get OpenGL symbols and it's probably better to use something like Glad (https://glad.dav1d.de/).