My application relies on being able to draw large images (1920x1080, full desktop) quickly. We are using Matrox Extio2 video cards and extenders to drive a twelve headed workstation as one large desktop. My code uses a BufferedImage and a call to drawImage() in paintComponent() to draw the image on the desktop.
Under XP or Win7, I am apparently getting hardware acceleration as the drawImage call completes in less than 0.05ms.
Under Windows Server 2008 R2, it takes almost 30ms for the same code to draw the same image using the same video hardware.
My java command line includes -Dsun.java2d.opengl=True and it claims that the OpenGL pipeline could not be enabled under Server 2008 R2. The Matrox video driver supports OpenGL 2.0 under Server 2008 R2 as I ran some OpenGL Extension View app and it works fine.
So I'm wondering if there is something under the hood in the JVM that is disabling OpenGL support on a server OS, and if not, how to enable the OpenGL pipeline.
Under Windows it is better to use the Direct3D pipeline in stead of the OpenGL pipeline for Java2D purposes. When running Java 6 update 10 or higher that should be the case automatically. So I would remove any configuration options that enable OpenGL. But that is still no guarantee - Java2D is incredibly unpredictable performance-wise and it will differ from machine to machine.
To remedy that you may want to investigate using something like JOGL (or JogAmp as it is called nowadays) or LWJGL to actually do your hardware accelerated drawing needs.
Thanks for the reply. I'm in new territory here and am ignorant about what is going on under the hood when I call graphics.drawImage(), but I'm trying to learn.
So here is what I have found out:
When I run DXDIAG on my server machine, it shows that all the displays have DirectWhatever enabled, which is good.
When I set J2D_TRACE_LEVEL=4 and run my app with no arguments about what to enable/disable, it says that:
D3DPPLM:: CheckOSVersion: Windows 2000 or earlier (or a server) OS detected, failed.
So I did a Google search for D3DPPLM and found some source code:
// require Windows XP or newer client-class OS
if (IS_WINVER_ATLEAST(5, 1) &&
"D3DPPLM::CheckOSVersion: Windows XP or newer client-classs"\
" OS detected, passed");
So it looks like Direct3D (D3D) is disabled in the Java runtime code for Server operating systems. Is there any way to work around this or am I misunderstanding what I'm looking at?
Thanks again for the reply. I will file a bug report, although someone clearly intended for it to behave this way (not sure why).
Our process control system has just started FAT and I hope the non-accelerated image drawing will be fast enough to be accepted by the customer. If not, then I will need to investigate using JOGL directly or something.