Problem with SDL_WINDOWID


I’m working with my 3d opengl engine under WIN32. I’m trying to support initializing opengl context onto an existing window using evironment SDL_WINDOWID because I want to use my engine for preview in my 3dsmax plugin. But it caused a series of errors.

First, if i destroy the window after calling SDL_QuitSubSystem, it will cause an memory illegle access within sdl. The code is like this:

_putenv(“SDL_WINDOWID=xxx”); //xxx is the value of variable hWnd
// … some OpenGL settings …
SDL_SetVideoMode (…)
// Now the sdl window successfully initialized in given window
// The below line will cause a crash
::DestroyWindow (hWnd);

Maybe the origin windowproc was not correctly restored?
if I replace the last line with:

SDL_SetVideoMode (…);

At this time the SetVideoMode function will fail at the
WIN32API SetPixelFormat() in file SDL_wingl.c.

Is this the SDL BUG ? Or I’v missed some thing ?


???–???555??? (