I decided to go back and try to rewrite my old FFMPEG code from C to C++ and SDL 1.2 to SDL 2.0. There was one issue I overlooked and that's whenever I read a frame from a video, I need to call SDL_GL_SwapWindow() as soon as the frame has finished or else I'll have an issue where in between each frame or so, the screen goes black. (or it just lags if I don't call glClear()) I also have to draw the frame immediately after it's read or else the same thing will happen except the screen will clear white instead of black.

The problem is, each video would have their own rendering code inside my Video class, or maybe I would want to render something else that's not a video, well, I would need to call SDL_GL_SwapWindow(), which I can't do or else it will interfere with my video.

And here's my while loop in main() that does the rendering and whatnot:

while (!Done)
{
while (SDL_PollEvent(&event))
{
HandleEvent(event, Done);
}
glClear(GL_COLOR_BUFFER_BIT);
TestVideo.Render(Win);
//This is where I want to call SDL_GL_SwapWindow()
}

So, what's the problem? Why do I need to draw each frame and call SDL_GL_SwapWindow() immediately after a frame is read? Ideally I should have two to three separate functions, one for reading each frame, one for rendering the read frame, and one for freeing up memory used by each frame. Any help is appreciated.