Writing a 2D Java application enjoys the hard-won benefits from Sun of Write Once Run Anywhere (WORA). We write an application in Java 2D, and if it does not work on a particular platform, we are surprised, nay even shocked.
When developing 3D applications, prepare to be shocked. It is alas quite common to see an application fail on a particular platform, but work well elsewhere.
Remember that in a 3D application, most of the work happens in the 3D engine on the video card. Indeed this must be the case, otherwise even a speedy modern CPU would slow to a crawl. Alas, the 3D engines are not nearly so uniform and well behaved as the JVM. Additionally, Java 3D does not have the benefits of Sun's mighty testing program. We have found many issues that trace back to quirks and differences in the 3D engine: the video card and the video driver. Sometimes the problems can be solved by upgrading your video driver. Other times, you may need to change your video card. Once you enter the world of 3D, you are leaving WORA behind you.
Video cards and drivers change quickly. The online version of this guide has the latest information that we can find to help you. You should also check the following helpful resources
Laptops tend to be problematic when running Java 3D. Some work well, but quite a few do not. Video drivers are harder to get (you have to get them from the laptop manufacturer), and tend to be buggier and more out-of-date. The video cards in laptops have less. Less video memory, less power, and less cooling. They just don't work as well as their cousins on the desktop machines.
Plan on spending extra time, money, and effort to get your application to run on a laptop.
Configuration for Java 3D under Linux can be tricky, but is possible. The binary build of Java 3D 1.3.2 at http://java3d.dev.java.net/binary-builds.html supports Linux. You may find some other information to help you at blackdown. Generally speaking, Linux video drivers don't work as well as their Window counterparts, and you will be more likely to experience problems, and roadblocks.
You should definitely use the latest version of Java 3D that is available. The Java 3D developers are hard at work improving the platform and fixing bugs. Thanks guys.
Currently, you can get Java 3D version 1.3.1 from Sun. You can also get version Java 3D 1.3.2 from java.net. You should definitely use OpenGL. As of 1.3.2, Java 3D does not work well with Direct3D. When you download Java 3D 1.3.1, you will need to choose OpenGL or Direct3D, and will obtain an installer. When you download Java 3D 1.3.2, you will get both OpenGL and Direct3D. It will default to using OpenGL. However, you will obtain a zip file and instructions but not an installer. Don't panic, it's really pretty easy.
Currently, you can download Java 3D 1.3.1 from http://java.sun.com/products/java-media/3D/download.html. You can currently download Java 3D 1.3.2 from http://java3d.dev.java.net/ or http://java3d.dev.java.net/binary-builds.html.
Many Windows XP users experience difficulties using OpenGL 3D with Java Swing components. It appears that some older video graphics drivers have difficulties with this combination. The application is using OpenGL hardware acceleration and nearby in the same window the Swing components are using DirectDraw hardware acceleration to draw themselves.
The symptoms are that the Swing widgets flicker and blink. You may have difficulty selecting focus in JText or JList widgets. JPopupMenus may be drawn without any text in them. The JText widgets may recycle old text. The symptoms can be mild and intermittent, or so severe that the application appears to be having a seizure. A discussion of this issue may be found on this forum and also on this thread.
At this time, the flickering swing widgets appears to be associated with NVidia cards. In particular, NVidia driver 4.5.0.2 (aka 45.02) from 11/3/2003 exhibits the problem. Driver version 7.1.8.9 (aka 71.89) from 4/1/2005 corrects the problem.
Any of the below approaches may fix this problem. The preferred approach is to update your video drivers.
Disable cursor and bitmap accelerations. Use this setting to correct problems with the mouse pointer, or to correct problems with corrupt images.
java -Dsun.java2d.noddraw=true MyApplicationIf you are running an applet (web based Java), you can set this property in the Java plug-in control panel. Go to Control Panel > Java Plug-in > Advanced and enter
"-Dsun.java2d.noddraw=true" (without the quotes) into
the Java Runtime Parameters text box.-Dsun.java2d.d3d=false may also be useful, although it does not
appear useful on our test machines.In some cases, you can experience very, very slow speed in the 3D application combined with very high CPU and memory consumption. Please realize that Microsoft provides in Windows a software based OpenGL rendering engine. This engine does not use the hardware acceleration on the video card, and thus is always available no matter the video card. Unfortunately, software rendering is so slow as to be almost completely useless. Your video driver can revert back to software rendering if your hardware is unable to support your configuration or rendering requests.
If your 3D applications are excruciatingly slow, it is possible that your system is using the software based OpenGL renderer.
See Bug 69 at java3d.dev.java.net. If you attempt to run any Java 3D program, such as HelloUniverse, on Windows/XP using the ATI driver, version 6.14.10.6467 dated 3-Aug-2004, it will crash with a memory fault in atioglxx.dll. The downloaded driver file name is: "wxp-w2k-8-042-040803a-016701c". This error happens with Java 3D 1.5_beta2 and Java 3D 1.3.1 (fcs) or 1.3.2-build5. The error message is as follows: java HelloUniverse
# # An unexpected error has been detected by HotSpot Virtual Machine: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x693f6643, pid=3436, tid=3008 # # Java VM: Java HotSpot(TM) Client VM (1.5.0-beta2-b51 mixed mode, sharing) # Problematic frame: # C [atioglxx.dll+0x3f6643] # # An error report file with more information is saved as hs_err_pid3436.log # # If you would like to submit a bug report, please visit: # ...
The application will not run, and either of the following error messages is displayed on the console
wglCreateContext Failed: The pixel format is invalid. Failed in wglCreateContext - Invalid access to memory location.This is known to happen with ATI driver versions 6.14.10.6467, 6.14.10.6483, and 6.14.10.6497. See the discussion at this Java Desktop thread. This discussion posts some potential workarounds although it is not clear if the proposed workarounds correct this issue. Driver version 6.14.10.6436 does not have this problem.
Java 3D version 1.3.2 has incorporated a fix for this issue. As well, this issue is specific to the OpenGL version of Java 3D, the DirectX version may work on your machine.
See Bug 104 at java3d.dev.java.net. Java3D based applications fail to start under the following ATI driver. http://www2.ati.com/drivers/wxp-w2k-catalyst-8-10-050119a-020581c.exe
See forum discussion for a summary of the situation.
removeAllCtxs().
# # An unexpected error has been detected by HotSpot Virtual Machine: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x5ed8051c, pid=2808, tid=2780 # # Java VM: Java HotSpot(TM) Client VM (1.5.0_02-b09 mixed mode) # Problematic frame: # C [OPENGL32.dll+0x8051c] # --------------- T H R E A D --------------- Current thread (0x0aface30): JavaThread "J3D-Renderer-1" [_thread_in_native, id=2780] ... C [OPENGL32.dll+0x8051c] C [OPENGL32.dll+0x78fa9] C [OPENGL32.dll+0x79050] C [OPENGL32.dll+0x808c8] C [OPENGL32.dll+0x8097b] C [OPENGL32.dll+0x783cb] C [OPENGL32.dll+0x2b02a] C [OPENGL32.dll+0x1bb91] C [j3dcore-ogl.dll+0x1ade] j javax.media.j3d.Renderer.removeAllCtxs()V+187 J javax.media.j3d.Renderer.doWork(J)V j javax.media.j3d.J3dThread.run()V+19 ...
Contact the Support team at: support@int.com
Copyright © 2005 by INT, inc. www.int.com All rights reserved.