I'm creating a basic 3D game in C++ with SDL2 and OpenGL3, and one of my learning goals for this project is to design my code around the ability to swap out SDL or OpenGL. However, the problem I'm finding is that the libraries are very coupled. It doesn't seem like I can just defineSDLWindow and GLRenderer classes due to functions like SDL_GL_*() (e.g SDL_GL_CreateContext()). Placing this function within SDLWindow would be a problem if I switched to Vulkan, while placing it in GLRenderer would be a problem if I switched from SDL.
What I would like to know is what strategies can I use to decouple these dependencies? Based on my knowledge, I assume I need some mechanism to conditionally call the appropriate functions, so my mind goes to using enums and switch statements, but I can either have each class function do this or create concrete implementations based on specific combinations of libraries, so SDLGLWindow instead of SDLWindow and SDLGLRenderer instead of GLRenderer, and then use a factory function that uses an enum and switch statement to select the correct class(es). In both cases, though, it feels like a lot of unnecessary code, which makes me doubt how practical of a solution it is.