OpenGL Rendering Context Lost on Windows but not Linux

I just got one of my linux boxes set up with KDevelop, and took a few
minutes to port over an SDL/OpenGL app I had been working on in Win2K. My
problem, if you can call it that, is that on the Windows side, whenever I
change resolution or toggle fullscreen in my app, I lose my OpenGL
textures, which I’d read was due to losing the rendering context and
having to get a new one. Now that I’m running it in Linux, I try switching
resolutions and toggling fullscreen on the fly, and it keeps the texture.
Right now, there are only a few things I can think of to account for this:

  1. I’m using SDL 1.2.7 on Gentoo, but 1.2.6 on Windows. I didn’t see
    anything about rendering contexts or textures in the CVS logs, but was
    this something changed in the newest version? I’ll install 1.2.7 on Win2k
    to figure that out.

  2. This system has on-board video, and my other win2k/gentoo box has a
    GeForce card in it. I thought it could be something in the XFree
    implementation. I know it can’t be the video chip because running the
    same program on the windows side loses my textures all the time.

I know the obvious solution is to just program in Linux, but I want to
stay as cross-platform as possible. So, all the way down here, my question
is:

Does anyone know of a way to keep OpenGL from losing your textures when
you change screen modes?

Whenever I change resolution, I call SDL_SetVideoMode, then do a bit of
OpenGL initialization, specifically, this:

void SDLApp::InitGL(void)
{
glClearColor(0.0f,0.0f,0.0f,0.0f);
glClearDepth(1.0f);
glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
}

Same thing goes for ToggleFullscreen, where I just set the flag
SDL_FULLSCREEN and call ChangeResolution(), which goes back to the code
above.

I’ve looked through the old mailing list archives, and found something
similar from last April in the thread “[SDL] Re: SDL_VIDEORESIZE, OpenGL,
Win32” It’s basically the same problem, whenever I change resolution or
toggle fullscreen on Win32, I have to spend a few seconds reloading
textures, and I’d rather not if I didn’t have to, like on Linux.

Thanks,
Chris

Hi Chris,

I’ve had the same problems, and found no solution or workaround. AFAICT,
you’ll just have to keep reloading your textures.

Bye,
Marc

Christian Doggett wrote:> I just got one of my linux boxes set up with KDevelop, and took a few

minutes to port over an SDL/OpenGL app I had been working on in Win2K. My
problem, if you can call it that, is that on the Windows side, whenever I
change resolution or toggle fullscreen in my app, I lose my OpenGL
textures, which I’d read was due to losing the rendering context and
having to get a new one. Now that I’m running it in Linux, I try switching
resolutions and toggling fullscreen on the fly, and it keeps the texture.
Right now, there are only a few things I can think of to account for this:

  1. I’m using SDL 1.2.7 on Gentoo, but 1.2.6 on Windows. I didn’t see
    anything about rendering contexts or textures in the CVS logs, but was
    this something changed in the newest version? I’ll install 1.2.7 on Win2k
    to figure that out.

  2. This system has on-board video, and my other win2k/gentoo box has a
    GeForce card in it. I thought it could be something in the XFree
    implementation. I know it can’t be the video chip because running the
    same program on the windows side loses my textures all the time.

I know the obvious solution is to just program in Linux, but I want to
stay as cross-platform as possible. So, all the way down here, my question
is:

Does anyone know of a way to keep OpenGL from losing your textures when
you change screen modes?

Whenever I change resolution, I call SDL_SetVideoMode, then do a bit of
OpenGL initialization, specifically, this:

void SDLApp::InitGL(void)
{
glClearColor(0.0f,0.0f,0.0f,0.0f);
glClearDepth(1.0f);
glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
}

Same thing goes for ToggleFullscreen, where I just set the flag
SDL_FULLSCREEN and call ChangeResolution(), which goes back to the code
above.

I’ve looked through the old mailing list archives, and found something
similar from last April in the thread “[SDL] Re: SDL_VIDEORESIZE, OpenGL,
Win32” It’s basically the same problem, whenever I change resolution or
toggle fullscreen on Win32, I have to spend a few seconds reloading
textures, and I’d rather not if I didn’t have to, like on Linux.

Thanks,
Chris


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

I just got one of my linux boxes set up with KDevelop, and took a few
minutes to port over an SDL/OpenGL app I had been working on in Win2K. My
problem, if you can call it that, is that on the Windows side, whenever I
change resolution or toggle fullscreen in my app, I lose my OpenGL
textures, which I’d read was due to losing the rendering context and
having to get a new one. Now that I’m running it in Linux, I try switching
resolutions and toggling fullscreen on the fly, and it keeps the texture.
Right now, there are only a few things I can think of to account for this:

  1. I’m using SDL 1.2.7 on Gentoo, but 1.2.6 on Windows. I didn’t see
    anything about rendering contexts or textures in the CVS logs, but was
    this something changed in the newest version? I’ll install 1.2.7 on Win2k
    to figure that out.

  2. This system has on-board video, and my other win2k/gentoo box has a
    GeForce card in it. I thought it could be something in the XFree
    implementation. I know it can’t be the video chip because running the
    same program on the windows side loses my textures all the time.

I know the obvious solution is to just program in Linux, but I want to
stay as cross-platform as possible. So, all the way down here, my question
is:

Does anyone know of a way to keep OpenGL from losing your textures when
you change screen modes?

Whenever I change resolution, I call SDL_SetVideoMode, then do a bit of
OpenGL initialization, specifically, this:

void SDLApp::InitGL(void)
{
glClearColor(0.0f,0.0f,0.0f,0.0f);
glClearDepth(1.0f);
glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
}

Same thing goes for ToggleFullscreen, where I just set the flag
SDL_FULLSCREEN and call ChangeResolution(), which goes back to the code
above.

I’ve looked through the old mailing list archives, and found something
similar from last April in the thread “[SDL] Re: SDL_VIDEORESIZE, OpenGL,
Win32” It’s basically the same problem, whenever I change resolution or
toggle fullscreen on Win32, I have to spend a few seconds reloading
textures, and I’d rather not if I didn’t have to, like on Linux.

The sad truth is that on Windows you lose the context when you change
the resolution of display mode. I don’t know if this is a design flaw in
Windows or what, but that is the way it is on Windows.

The only thing you can do about it is complain to MS. Of course, they
want you to use DirectX so it is not in their best interest to fix
problems like this one in OpenGL. Until MS fixes the problem, you have
to live with it.

		Bob PendletonOn Tue, 2004-03-09 at 15:16, Christian Doggett wrote:

Thanks,
Chris


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

±--------------------------------------+

The same happens in DX.
You don’t have the garantee to always have the
surfaces(textures) loaded. That’s why DX has
an event for lost surfaces.–
Paulo

Bob Pendleton wrote:

On Tue, 2004-03-09 at 15:16, Christian Doggett wrote:

I just got one of my linux boxes set up with KDevelop, and took a few
minutes to port over an SDL/OpenGL app I had been working on in Win2K. My
problem, if you can call it that, is that on the Windows side, whenever I
change resolution or toggle fullscreen in my app, I lose my OpenGL
textures, which I’d read was due to losing the rendering context and
having to get a new one. Now that I’m running it in Linux, I try switching
resolutions and toggling fullscreen on the fly, and it keeps the texture.
Right now, there are only a few things I can think of to account for this:

  1. I’m using SDL 1.2.7 on Gentoo, but 1.2.6 on Windows. I didn’t see
    anything about rendering contexts or textures in the CVS logs, but was
    this something changed in the newest version? I’ll install 1.2.7 on Win2k
    to figure that out.

  2. This system has on-board video, and my other win2k/gentoo box has a
    GeForce card in it. I thought it could be something in the XFree
    implementation. I know it can’t be the video chip because running the
    same program on the windows side loses my textures all the time.

I know the obvious solution is to just program in Linux, but I want to
stay as cross-platform as possible. So, all the way down here, my question
is:

Does anyone know of a way to keep OpenGL from losing your textures when
you change screen modes?

Whenever I change resolution, I call SDL_SetVideoMode, then do a bit of
OpenGL initialization, specifically, this:

void SDLApp::InitGL(void)
{
glClearColor(0.0f,0.0f,0.0f,0.0f);
glClearDepth(1.0f);
glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
}

Same thing goes for ToggleFullscreen, where I just set the flag
SDL_FULLSCREEN and call ChangeResolution(), which goes back to the code
above.

I’ve looked through the old mailing list archives, and found something
similar from last April in the thread “[SDL] Re: SDL_VIDEORESIZE, OpenGL,
Win32” It’s basically the same problem, whenever I change resolution or
toggle fullscreen on Win32, I have to spend a few seconds reloading
textures, and I’d rather not if I didn’t have to, like on Linux.

The sad truth is that on Windows you lose the context when you change
the resolution of display mode. I don’t know if this is a design flaw in
Windows or what, but that is the way it is on Windows.

The only thing you can do about it is complain to MS. Of course, they
want you to use DirectX so it is not in their best interest to fix
problems like this one in OpenGL. Until MS fixes the problem, you have
to live with it.

  	Bob Pendleton

Thanks,
Chris


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Doesn’t X treat resolution differently than Windows? I seem to recall that
if the current screen size is less than the maximum configured resolution,
you’re still, in some respects, running at the maximum. Perhaps that
allows more state to be retained.

At 03:16 PM 3/9/2004 -0600, Christian Doggett wrote:>I just got one of my linux boxes set up with KDevelop, and took a few

minutes to port over an SDL/OpenGL app I had been working on in Win2K. My
problem, if you can call it that, is that on the Windows side, whenever I
change resolution or toggle fullscreen in my app, I lose my OpenGL
textures, which I’d read was due to losing the rendering context and
having to get a new one. Now that I’m running it in Linux, I try switching
resolutions and toggling fullscreen on the fly, and it keeps the texture.
Right now, there are only a few things I can think of to account for this: