My application takes several seconds to show the first window with a Canvas3D
in it. I've profiled it and found that the bottleneck is in SimpleUniverse.getPreferredConfiguration()
; the first call takes three or four seconds, and it must be called before the scene can be rendered.
I'm using the Direct3D renderer (-Dj3d.rend=d3d
), because the OpenGL renderer crashes on my graphics card. I have an integrated ATI card running a single monitor.
The reason for the slowdown is that GraphicsDevice.getConfigurations()
, which is used by SimpleUniverse.getPreferredConfiguration()
, is very slow on some systems. See this java.net forum thread, which links to this Java3D bug, which in turn links to this Sun bug:
The problem is that
::DescribePixelFormat
Win32 call is slow - takes up to 60ms to complete. ...
With the suggested workaround (which elminats [sic] the offending win32 calls) the time is significantly improved (to, like, 0ms).
The workaround mentioned is to pass -Dsun.awt.nopixfmt=true
to the JVM, which makes the underlying native code not call DescribePixelFormat
.
This apparently is not a perfect solution:
... some applications which use OpenGL with Java may not work correctly.
But since I was using Direct3D anyway, it's not a problem. This cut 3.2 seconds off of the startup time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With