   Does there exist a way to know the opengl context was destroyed?
  When using SDL + OpenGL in Windows, and when working in windowed mode and the window is resized, you need to create a new screen with SDL.I have a feeling that in some versions of SDL, this destroyes the GL context, in others it does not.If the GL context was destroyed, all textures become white. All textures have to be generated again.If the GL context was NOT destroyed, then recreating all textures will cause a memory leak, because the previous ones were not glDeleted!The problem is, I have no idea whether or not a call to SDL_SetVideoMode will destroy the GL context or not.And I found no way in the SDL or OpenGL specification to find out whether or not it was destroyed!So after a SDL_SetVideoMode, I have the choice between either potentially have all textures become white, or have a memory leak.How can I solve this problem in a multiplatform way?I used to have an #ifdef to distinguish between Windows (where the GL context was destroyed) and Linux (where it wasn't). But now I found out that even between different version of SDL 1.2.x in Windows, it might be so that the GL context is possible NOT destroyed! I'd like to have a reliable way to know that it was destroyed or not.If SDL is responsible for creating and destroying the GL context, why doesn't it provide any functions in its API to let a user find out whether or not the GL context was destroyed? It seems pretty important to know that information, especially when the same SDL function can or cannot destroy the context depending on version and platform.   
  If you resize a window, the GL context gets destroyed?Sounds like you are doing something wrong.If you want a resizable window, you needSDL_RESIZABLE as one of the flag parameters of SDL_SetVideoMode and that is all. You don't need to call SDL_SetVideoMode each time the window is resized because that would probably destroy the GL context and recreate it.   ;  To extend V-man's statement, the *only* time that the OpenGL context will be lost is when you explicitly destroy it (with SDL_SetVideoMode, or SDL_Quit).Further, the only time you need to call SDL_SetVideoMode (apart from initialisation), is if you wish to switch between windowed and fullscreen modes, of if you need to change screen resolutions while in fullscreen mode.   ;  In that case I have opposing sources.Various sources say that when the windows is resizable, that SDL_SetVideoMode should be resized when you get an SDL_VIDEORESIZE event.Furthermore, if I don't call SDL_SetVideoMode after receiving a SDL_VIDEORESIZE event, then the window is resized, but the graphics inside the window look messed up, as if OpenGL is still drawing to the original size. Why is that?Example of a source that says that SDL_SetVideoMode can be called after SDL_VIDEORESIZE: http://sdl.beuc.net/sdl.wiki/SDL_SetVideoMode.From that source:Quote:SDL_RESIZABLECreate a resizable window. When the window is resized by the user a SDL_VIDEORESIZE event is generated and SDL_SetVideoMode can be called again with the new size.This whole screen resizing thing has been giving me more trouble than it's worth. No clear specification about when SDL_SetVideoMode does or does not destroy the GL context only makes it worse. Opposing sources are also a problem!What IS the deal with having a resizable OpenGL window with SDL and how can it be done properly on any platform!Thanks.   ;  You are always meant to call SDL_SetVideoMode on a window resize event (and so have to reload all textures). However, I remember reading somewhere on gamedev that you can avoid doing this and get away with it (just update the viewport?), as long as you don't depend on absolute mouse coordinates from SDL mouse motion events (I think).I opted not to let my app be resizeable with click and drag, because it was too much effort. If you really want a resizable window though, it's probably best to delete all your textures explicitly yourself to avoid leaks before calling SDL_SetVideoMode.   ;Quote:Original post by LodeFrom that source:Quote:SDL_RESIZABLECreate a resizable window. When the window is resized by the user a SDL_VIDEORESIZE event is generated and SDL_SetVideoMode can be called again with the new size.This applies to SDL when used with software and hardware surfaces, *not* SDL used with OpenGL.When using OpenGL with SDL, you only need to set your OpenGL viewport and projection matrices to match the new size/aspect ratio.Quote:No clear specification about when SDL_SetVideoMode does or does not destroy the GL context only makes it worse.On Windows and Mac, SDL_SetVideoMode *always* destroys and re-creates the OpenGl context. On Linux, it *never* destroys/re-creates the OpenGL context.For other platforms, you need to consult the source code.Quote:What IS the deal with having a resizable OpenGL window with SDL and how can it be done properly on any platform!Simple: never call SDL_SetVideoMode on a window resize event. You do need to fix your OpenGLviewport and projection though - these are what makes the image distorted if you forget to call them on resize.