[SDL] Problem with SDL_WINDOWID

gaoyakun gaoyakun at sina.com
Mon Nov 10 19:00:01 PST 2003


hello!

  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
  SDL_InitSubSystem(SDL_INIT_VIDEO);
  // ... some OpenGL settings ...
  SDL_SetVideoMode (...)
  // Now the sdl window successfully initialized in given window
  SDL_QuitSubSystem(SDL_INIT_VIDEO);
  // 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_InitSubSystem(SDL_INIT_VIDEO);
  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 ?
  
                                                     Thank's!

  
______________________________________

===================================================================
°®¹úÕßÊýÂëÏà»ú°éÂÂÍõ--´øÉÏ555¸ö½º¾íÈ¥ÂÃÓÎ (http://ad4.sina.com.cn/shc/zhuiyu_hprefresh.html)




More information about the SDL mailing list