Odd effects after switching resolution

Hi everyone. In my quest to figure out how to reliably toggle resolutions, I’ve noticed some strange effects, which I think are due to the camera not updating correctly.

On a keypress, this is called to toggle fullscreen:

[java]

app.settings.setFrequency(ge.getDisplayMode.getRefreshRate)
app.settings.setFullscreen(true)
app.settings.setResolution(ge.getDisplayMode.getWidth, ge.getDisplayMode.getHeight)
app.setSettings(settings)
app.restart

cam.resize(settings.getWidth, settings.getHeight, true)
cam.update
…[/java]
What it should look like:

What it sometimes, but not always, looks like:

Or…

A few points:

  • There are no filters
  • The ground is a large, flat rectangle with a texture
  • I’ve tried enqueuing cam.resize and cam.update after the call to app.restart, but this doesn’t make a difference
  • Starting the game directly into fullscreen works fine, it’s just toggling it.