c++sfmlglad

can SFML and glad be used in the same project


I am compleatly new to both SFML and OpenGL. Following the holy LearnOpenGl tutorial I managed to make a triangle, but now I have used SFML for a lot of a project already and I need to do something in 3d, thus (I think) I need glfw and glad but when I try to glad gives me the following error: OpenGL header already included, remove this include, glad already provides it. If I have made a big mistake I dont understand why so could someone please explain how to use them both or why only one can be used?


Solution

  • From what I understand glad already includes the necessary GL headers. So just do what the error message tells you and remove your own "include" of OpenGL. Only include the glad headers.

    Also from my experience you do NOT need GLFW when using SMFL, as SFML provides a valid OpenGL context for you when creating a window.