How to at any time change a OGL into fullscreen?

Sorry,I am a programmer who is a Chinese. I cannot speak English very well.I hope you can understand me.

My question is:In win32,How to at any time change a OGL into fullscreen?

I saw Nehe’s lesson,use ChangeDisplaySettings to change window into fullscreen.But if need at any time to change it,need to killwindow then createwindow.But that result the texture cannot show.

This is Nehe’s lesson code.

 if (keys[VK_F1])
    {
     keys[VK_F1]=FALSE;
     KillGLWindow();
     fullscreen=!fullscreen;
     if (!CreateGLWindow("Nehe's OpenGL ",640,480,16,fullscreen))
     {
      return 0;
     }
    }

Though it can at any time change a OGL into fullscreen,texture that created before killwindow cannot show in new window.

Have any other ways to at any time change a OGL into fullscreen,isn’t have?

[quote=尘羽泯]But that result the texture cannot show.
[/QUOTE]

Recreate the texture.

Bad idea…
Any other ways?..

Why is deleting and creating a new texture bad.
That is the only way.

Why is deleting and creating a new texture bad.

Is that a serious question? Are you seriously asking someone why they find having to reload all of their loaded assets bad?

In any case, the NeHe code does full-screening by destroying and rebuilding the window. It’s entirely possible to simply resize and reposition the window, then use the DEVMODE stuff in the NeHe code to resize the screen.

[quote=尘羽泯]Bad idea…
Any other ways?.. [/QUOTE]

If you destroy the window you also destroy the OpenGL context that goes with it. Textures are a part of the context, so they must be recreated. The same goes for VBOs, display lists, program and shader objects, etc.

Is that a serious question? Are you seriously asking someone why they find having to reload all of their loaded assets bad?

Nobody mentioned tones of textures…only one. I was just asking why it was a problem for just 1 texture. If recreating the texture works and takes less time than researching the utopia solution then it’s good enough. Time saved could be spent doing something more useful.

He never said it was just one texture. It’s quite an assumption to assume that the only application he would ever write would use one texture. Remember: he’s learning, so his initial applications aren’t necessarily indicative of what he may eventually write.