Switching from fullscreen to windowed mode

Hi,

when my game app has to swap from fullscreen to windowed mode, the performance is decreasing dramatically, and it becomes unplayable.

switching from windowed to fullscreen mode works ok. (at least when the game started in windowed mode)

The code is available here: http://kurve.knot.be/kurve-online.rar

This is the switching code:


    private void setFullscreen()
    {
        if(dm==null || !gd.isFullScreenSupported())
        {
            fullscreen = false;
            System.out.println("# Fullscreen mode is not supported by your graphics device");
            System.out.println("# Switching fullscreen mode off");
            setWindowed();
        }
        else
        {
            fullscreen = true;
            gd.setFullScreenWindow( frame );
            gd.setDisplayMode( dm );
        }
    }

    private void setWindowed()
    {
        if(fullscreen)
        {
            gd.setFullScreenWindow(null);
        }
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
        frame.toFront();
    }

I think you’re running into a known bug (I don’t have the bug id handy). The bug is that in some circumstances we’d disable acceleration after display mode change (or going to/from fullscreen).