[SDL] Re: Where have all my textures gone (Curtis Cooper)
Curtis Cooper
curtis at lpl.arizona.edu
Mon Aug 5 13:13:01 PDT 2002
Hi,
I've done some more work on this issue, and I have now understood it, I
believe. Firstly, I now understand the problem which was pointed out to
me about my disappearing textures in Windows. It makes perfect sense, of
course. If it's creating a totally new rendering context, and textures
and other objects are attached to rendering contexts, then it stands to
reason that they will disappear from the scene upon redraw if the
rendering context is recreated. So, I know I need to reload the textures
into texture memory right after the SDL_SetVideoMode in Windows.
However, is there another SDL function that works for OpenGL that only
resizes the current rendering context, or places that context into
fullscreen mode, without destroying it?
As for the second issue that I was having with the X server maintaining
the current fullscreen resolution after SDL_Quit(), I've resolved that
simply by reverting back to windowed mode just before calling
SDL_Quit(). The code looks roughly like this:
//////////////////////////////////// inside Main Loop ///////////////////
if ( force_quit )
{
#ifndef WIN32
// Necessary cleanup in Linux of the
// fullscreen mode if it exists.
if ( Fullscreen() )
{
// Better hope this works!
main_screen = SDL_SetVideoMode(1280,1024, bitsPerPixel(),SDL_OPENGL);
if ( !main_screen )
{
cerr << "Reset video mode failed.\n";
}
}
#endif
SDL_Quit();
}
/////////////////
Sorry if this solution was obvious from the start.
Thanks,
Curtis
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Curtis S. Cooper, Graduate Research Assistant *
* Lunar and Planetary Laboratory, University of Arizona *
* Kuiper Space Sciences, Rm. 318 *
* 1629 E. University Blvd., *
* Tucson, AZ 85721 * * * * * * * * * * * * * * *
* Wk: (520) 621-1471 *
* * * * * * * * * * * * *
More information about the SDL
mailing list