
Changing resolution and fullscreen state while running.
Posted Tuesday, 3 May, 2011 - 11:11 by Kobra inI have been adding graphics settings to my project. But I cannot figure out how to correctly change the resolution or go in or out of fullscreen mode while the the project is running.
Using WindowState = WindowState.Fullscreen; and WindowState = WindowState.Fullscreen; work, but they modify the viewing area and setting GL.Viewport doesn't fix it.
I am currently changing the monitor resolution with DisplayDevice.GetDisplay(DisplayIndex.Default).ChangeResolution
Can someone please explain the correct procedure to changing the resolution and/or fullscreen state in while the game is running.


Comments
Re: Changing resolution and fullscreen state while running.
To change the resolution use
DisplayDevice.ChangeResolution(). To move the application window to/from fullscreen, useWindowState = WindowState.Fullscreenand call GL.Viewport to update the viewport.These will work even when the game is running. Do note that you will need to recreate any window-sized FBO textures/renderbuffers you are using.
There's nothing more to it - this should work fine. Can you describe the problem you are encountering in a little more detail?
Re: Changing resolution and fullscreen state while running.
Success! I have managed to get it working. I was having a problem where the view area was incorrect after I set the viewport and GameWindow Height/Width. But I fixed that recreating my camera.
Yesterday I was also having problems with the monitor resolution not changing when calling
DisplayDevice.ChangeResolution()in some cases, but today, it seems to have been magically fixed.The only problem I am currently having is restoring the monitor to the desktop resolution (not necessarily the native resolution) for when I swap from fullscreen to windowed.
DisplayDevice.RestoreResolution()appears to have no effect.Re: Changing resolution and fullscreen state while running.
Which OS and opentk version are you using?
Re: Changing resolution and fullscreen state while running.
Windows 7 64bit, the version of OpenTK.dll is 1.1.399.52617