Dsun.java2d.noddraw=true

[quote]On Windows you should specify -Dsun.java2d.noddraw=true when launching JOGL apps to prevent conflicts with the DirectDraw implementation of Java2D.
[/quote]
Is this a general “best practice” statement? If it is, then shouldn’t jogl detect the operating system and set this automatically during initialization?

Also, this flag does not work for me. With the flag enabled, I get this in a fullscreen app:

http://home.earthlink.net/~kduling/jogl/noddraw.png

Not specifying the flag I get this, which is the correct image:

http://home.earthlink.net/~kduling/jogl/ddraw.png

We had similar problems with the fullscreen mode in Jake2 (http://www.bytonic.de/html/jake2.html). With noddraw=true the order of setLocation(), setSize()… seems to be very important. The following code works for us.

Holger


window.setUndecorated(true);
window.setResizable(false);
      
device.setFullScreenWindow(window);
device.setDisplayMode(displayMode);
                  
window.setLocation(0, 0);
window.setSize(displayMode.getWidth(),displayMode.getHeight());
canvas.setSize(displayMode.getWidth(),displayMode.getHeight());

Hi

I’ve had OutOfMemoryErrors in my game (which does not run in exclusive full-screen) when Dsun.java2d.noddraw is true, but not when it’s off.

I have a separate JFrame with some fairly complex Swing components in it (JTable etc), and as far as I can tell, the OutOfMemoryError only happens when this window is visible while the game is loading models etc.

I don’t run in true full-screen mode so I don’t need this flag, but beware - it looks like there could be problems with Swing in some situations when noddraw is true.

Kevin

Is there a way to specify -Dsun.java2d.noddraw=true in code, rather than on the command line? I’m trying to make my app as easy to start as possible by eliminating all these nasty command line switches.


System.setProperty("sun.java2d.noddraw", "true" );

Unless this property needs to be set before the main method is started, this should do the trick.

That got it, thanks. I was shying away from setProperty() because when I tried to use it for other things (java.library.path for JOGL) it didn’t work out.

As mentioned above, there are workarounds necessary to make full-screen support work on Windows when -Dsun.java2d.noddraw=true is specified as well as on Mac OS X. Example code for these workarounds is contained in the demos.fullscreen package in the jogl-demos workspace (look for FIXME in the sources). The Java2D team has fixed the Windows bug in Mustang, BTW.