"reset" SDL after setting custom openGL program?

Hi all,
I’m trying to mix SDL rendering with openGL using custom shaders.
I got everything up and running, but looks like setting my custom program affects SDL and corrupts its internal state or something like that.

For example, stuff I render with SDL after my shader program appear upside down. Sometimes with wrong blending mode.

I set my program with:

I tried restoring the previous SDL program by querying the program before setting mine, using

glGetIntegerv(GL_CURRENT_PROGRAM, &_defaultProgram);

and then

when I’m done, but it didn’t help. I also tried setting null.

In all examples I found of SDL + shaders they also flip the backbuffer manually right after using their shader, but I want to mix SDL and custom shaders in the same frame without rendering to texture and without forcing the openGL rendering to go last, so its not suitable.

Is there a way to tell SDL to ‘reset’ its internal states or whatever needed to make it recover after I changed the program?