[SDL] Where have all my textures gone?
walisser at mac.com
Sun Aug 4 13:09:01 PDT 2002
On Sunday, August 4, 2002, at 02:44 PM, Curtis Cooper wrote:
> Firstly, sorry if this is an old topic; I joined the list this
> morning, so I'm way behind.
Tried searching the list archives?
> I'm working on an OpenGL/SDL game which employs texture mapping heavily.
> I'm getting weird behavior under Windows using VC++ 6 that I'm not
> in Linux.
> In Linux, this works perfectly. My OpenGL scene gets redrawn perfectly
> the new resolution, with all the textures intact, etc. The scene just
> like a smaller version of the original. On the other hand, with the
> exact same source code compiled with VC++ 6 on Windows 2000, however,
> behavior of the 'f' key is quite different. It causes my OpenGL scene
> be resized to the lower resolution all right, but now all the textures
> for the polygons in the scene are gone! Is this a glitch in the SDL
> implementation for MS Windows, or have I made a subtle memory-related
> programming error?
The Windows code for SDL is likely destroying and recreating the OpenGL
context when you switch resolutions. You should release all of your
textures before calling SDL_Quit(), then reload them after calling
SDL_SetVideoMode(). You should also save/restore any other OpenGL state
you had before, like the viewing transformation etc.
More information about the SDL