Bug: When using GLCanvas and entering "fullscreen exclusive mode" using AWT with setFullScreenWindow()/setDisplayMode() the GLCanvas stays "white" and the OpenGL output is NOT rendered. This issue is Vista and Windows 7 specific. Everything works fine under XP. It has stg to do with the "Desktop Window Manager" (DWM). Also this issue seems to be NVidia Specific (tested on GeForce 8800M GTX under Vista 32 bit and GeForce 7900 GT on Windows 7 64 bit). On ATI everything is ok (tested on ATI Mobility Radeon HD 4570 under Windows 7 64 bit). The Java Version doesnt seem to matter, tested in on nearly every version above 1.6.0_15. JOGL Version used is: jogl-2.0-pre-20100616-windows-i586 (but the bug was already present in the old jogl 1.1.1a codebase I used before switching to jogl2.0) The issue appeard at first nearly a year ago with another driver update from NVidia. At first I did not bother and hoped it would resolve in one of the next driver releases. But none corrected the problem and there have been at least half a dozen. So I guess theres no hope that the problem somewhat magically "disappears" with another new driver release. Theres was also a quite extensive discussion on that issue at javagaming.org http://www.javagaming.org/index.php/topic,22086.msg182263.html#msg182263 but none of the suggestions resolved the issue (other than disabling DWM - See Workaround 2). Sourcecode to reproduce: Simply use one of ur own fullscreen examples http://github.com/sgothel/jogl-demos/blob/master/src/demos/fullscreen/GearsFullscreen.java (ofcourse with -Dsun.java2d.noddraw=true) Workaround 1: If u "alt-tab" (minimize the window and maximize it back in) the GLCanvas-Frame the content is rendered correctly. Workaround 2: Disabling DWM by switching to "Windows Classic"-Design resolves the problem. Wich is ofcourse unacceptable to work under the Windows 2000 look-and-feel under Vista/Win7 and also requires Adminitrator privileges to do the switch.
Implemented a small workaround for the bug using JNA (Java Native Access) to disable the DWM via a native call before setting up the GLCanvas. JNA interface declaration: import com.sun.jna.*; public interface dwmapi extends Library { dwmapi INSTANCE = (dwmapi)Native.loadLibrary("dwmapi",dwmapi.class); //http://msdn.microsoft.com/en-us/library/aa969510%28VS.85%29.aspx public int DwmEnableComposition(int uCompositionAction); } ... and then the corresponding call from my application right before the GLCanvas setup: dwmapi.INSTANCE.DwmEnableComposition(0); At least this resolves the issue of manually dsabling the DWM. As far a I have tested, it works fine on NVidia platforms. Tests on ATI pending ...
I hesitate to add OpenGL driver bugs here, especially for the EOL (end of life) AWT support .. (more on this in a later post). You can use fullscreen with NEWT easily, I like to recommend this. Otherwise .. we would need the Windows compositioning toggle in our native library ? Please vote and test .. thx. (we may have to reopen this bug then)
Jogl2 and Fullscreen.. just an idea.. what about switch of the dwm inside the game..and then a crash in the app.. is the dwm still switch off ??? ..and what normal user/gamer knows how to reactivate. another idea: the fullscreen is working..but needs to alt-tab twice to run.. why not simulate this after the init: the robot function can do this! and with this..it should work on win xp,vista,win7 and should not disturbing mac ... import java.awt.*; import java.awt.event.KeyEvent; ... ... init fullscreen stuff start thread/animator ... use_alt_tab(); // switch background use_alt_tab(); // switch foreground ... setupOpengl stuff ... its possible that the keyboard handler got no focus on the running game app till the mouse clicks left in the game window.. even that can do the robot without doing any damage. ---------------------------------------------------- public void altTab() { try { Robot ky_app = new Robot(); ky_app.delay(1500); //give it a little time ky_app.keyPress(KeyEvent.VK_ALT); ky_app.keyPress(KeyEvent.VK_TAB); ky_app.keyRelease(KeyEvent.VK_TAB); ky_app.keyPress(KeyEvent.VK_TAB); ky_app.keyRelease(KeyEvent.VK_TAB); ky_app.keyRelease(KeyEvent.VK_ALT); } catch (Exception e) { System.out.println("Problem..."); } } (In reply to comment #2) > I hesitate to add OpenGL driver bugs here, > especially for the EOL (end of life) AWT support .. > (more on this in a later post). > > You can use fullscreen with NEWT easily, I like to recommend this. > > Otherwise .. we would need the Windows compositioning toggle > in our native library ? Please vote and test .. thx. > > (we may have to reopen this bug then)
> what about switch of the dwm inside the game..and then a crash in the app.. is > the dwm still switch off ??? ..and what normal user/gamer knows how to > reactivate. Thats no problem since DWM composition will be automatically (re)-enabled when all processes that have disabled composition have been terminated. So if the JOGL app crashes everything will be set back to normal automatically. > another idea: the fullscreen is working..but needs to alt-tab twice to run.. > why not simulate this after the init: Have u tested this ? Could be a nice and effortless multiplatform workaround for this issue.