For a long time I’ve been unsuccessfully trying to understand how full screen support works on e.g. Windows, where some drivers apparently enable triple buffering (faster than monitor refresh rates without disabling the sync to vertical blanking) for full-screen games. I’ve searched the net fairly extensively and tried to find the appropriate code in the Quake sources, but the SciTech MGL was so opaque I couldn’t figure out where it bottomed out into real Windows API calls.
The JDK’s built-in full screen support on Windows actually has two implementations, depending on whether -Dsun.java2d.noddraw=true is specified. Theoretically, it is a must to pass this command line flag to any Java application using OpenGL on Windows because of driver-level incompatibilities between DirectDraw and OpenGL, and the Java2D implementation uses DirectDraw for some operations by default.
The -Dsun.java2d.noddraw implementation of full-screen support uses the WinGDI API ChangeDisplaySettings and related calls, without getting DirectDraw involved. The existing component’s size is changed (to the best of my recollection) and it is positioned to take up the full screen.
A few months ago I looked at LWJGL’s full-screen support and saw that it seemed to pass several different flags to the window creation process than the AWT does. I’d like to do a prototype with JOGL that does similar operations and creates a window without using the AWT. The new APIs I’ve been thinking of would be along the lines of
GLDrawableFactory:
DisplayMode[] getDisplayModes();
GLDrawable createFullscreenDrawable(DisplayMode, GLCapabilities, GLCapabilitiesChooser);
The reason to avoid using the AWT’s GraphicsDevice class is that you can’t get enough platform-specific information from it (I’ve tried in the past, probably while working on GL4Java).
I don’t think GLDrawable would have to change though we might want to add a sub-interface called GLFullscreenDrawable or similar which would add some methods for switching back from full-screen mode without terminating the application. (GLPbuffer does the same thing without exposing a concrete class in the public API.)
Let me know what you think about this.