[SDL] Where have all my textures gone?
Darrell Walisser
walisser at mac.com
Sun Aug 4 13:09:01 PDT 2002
On Sunday, August 4, 2002, at 02:44 PM, Curtis Cooper wrote:
> Hi,
>
> 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
> seeing
> in Linux.
>
> In Linux, this works perfectly. My OpenGL scene gets redrawn perfectly
> at
> the new resolution, with all the textures intact, etc. The scene just
> looks
> 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,
> the
> behavior of the 'f' key is quite different. It causes my OpenGL scene
> to
> 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
> SDL
> 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
mailing list