I've been seeing people combine SDL2 and OpenGL (glfw.h or glut.h) for a while now, I've done some research and found out SDL2 runs on OpenGL. So why does people combine these two? Some people discussed how they use SDL2 for making the window and OpenGL for everything else, but that doesn't make sense since OpenGL can create windows as well.
GLFWwindow *window = glfwCreateWindow(WIDTH, HEIGHT, "Opengl Tutorials", NULL, NULL); glfwMakeContextCurrent(window); // Cause OpenGL to work on this window glfwSetKeyCallback(window, KeyCallback); // Callback to handle key events glfwSetCursorPosCallback(window, MouseCallback); // Callback to handle mouse motion events glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
Some also say they use SDL2 for 2D animations, but that doesn't make sense as OpenGL can do that as well. As I said before SDL2 uses OpenGL so anything SDL2 can do, OpenGL can do, SDL2 is a wrapper of OpenGL. So why do people still add SDL2 and OpenGL together? For example these.
Is there any advantage? Is there something I'm missing? I'm so confused. Why would you combine SDL2 with OpenGL even though SDL2 is only a wrapper?
Between this is all for C/C++ so that may clear up some confusion. When I refer to OpenGL I'm referring to glut.h or/and glfw.h not OpenGL by itself since I don't know if you can do that.