Taking over an SDL window


I am really new to SDL, so please bear with me…

I am making a DLL extension for a piece of 2D game coding software (called
Fenix). My extension is a 3D engine using opengl.

Fenix uses SDL…so that’s why i’m here. Fenix uses software blitting onto a
hardware SDL_Surface (called “screen”) set using SDL_setvideomode.

In my DLL, I take over the window to use for opengl. (I would then like to grab
the data from the “screen” surface, and send it to opengl as a texture, so that
I can still display Fenix’s software drawing, but from within my 3D engine.)

However, I don’t know how to stop SDL from playing with the window.

If I re-set “screen” as a memory surface using SDL_CreateRGBSurface I can see my
opengl!! (this was quite a breakthrough for me…)

However, I think SDL is still somehow attached to the window, as I see some
weird things in my opengl, like the depth buffer is still being modified or
something…polygons appearing in front of closer ones etc…

The only time I can get my opengl to display normally is when Fenix does
absolutely no software drawing (and therefore probably does not call sdl
update or flip functions).

Sorry for the long explanation…can anyone help me?