According to the JOGL User Guide, the noddraw flag should be set true when running on Windows. The guide gives a command line switch to be used. Is there an equivalent way to set this flag from within an application? I’m thinking of checking the os.name system property to see if the app is running on Windows, and setting the property programmatically if appropriate. Is this an acceptable approach?
Hi, Commander:
Thanks for the quick response.
As it turns out, I’m using exactly the code shown in that thread - in main(), I call ‘System.setProperty(“sun.java2d.noddraw”, “true”);’. I wasn’t sure it was working, though, because if I call System.getProperty(“sun.java2d.noddraw”), it returns null. I’d expect something other than a null return value if it was a valid property name; or is it totally irrelevant?
No sweat!
Yes, you’re right that System.getProperty(“sun.java2d.noddraw”) should return true after you have set it (I think). Perhaps you are setting it after something has been drawn and it’s too late to change the graphics pipeline? You should set the property in the main class’s static intialiser. Note that this programmatic way of setting this property does not work with webstart, this problem is mentioned in that thread somewhere.
To test if it is actually working, try setting some other property that has an obvious effect, like the opengl pipeline - System.setProperty(“sun.java2d.opengl”, “True”)
Note that capital T in True, this will cause the VM console to print out if the opengl pipeline is working or not 8).
Hi, Commander:
Actually, calling getProperty AFTER setProperty works fine. I was calling it first in the expectation that if it were a valid system property it would already exist.
I, errr, guess that’s not how it typically works, huh? ;D
This tip regarding the capital ‘T’ - does this work with all system properties? (Bit of a Java noob here - my background has been primarily in C++.)
One further point worth noting - you will run into problems doing the above if you are launching your app. using webstart, or an Applet - this is due to the java2d pipeline having already been initialised before the application code is invoked.
Thanks for the tip, Abuse. This particular project is a desktop app, but there are a couple of applets I’m considering developing, so that is useful information.
No, it’s a weird idiosyncracy that only works with opengl. If you haven’t already, see this for some detail: http://java.sun.com/j2se/1.5.0/docs/guide/2d/flags.html
Thanks, guys.