Google 新聞群組首頁
新聞群組BETA
 
 • 進階新聞群組搜尋
 
Groups search result 4 for

寄件者:Bill Hibbard (billh@ssec.wisc.edu)
主旨:Re: Porting C and OpenGL code to Java and Java 3D
新聞群組:comp.lang.java.advocacy
View: Complete Thread (4 articles) | Original Format
日期:2001-11-23 03:53:49 PST
In article <89c87e90.0111211021.16c0fb3f@posting.google.com> andeeee1227@yahoo.com (really cool guy) writes:
>We have an application written in C/X/Motif, heavily using OpenGL
>libraries.  This application is over a hundred thousand lines of code.
>We are considering re-writing this application in Java/Swing/Java 3D,
>or alternatively, jettisoning UNIX support and porting to MFC.  We
>don't have large project experience with Java.  It would be a lot of
>work, however, we feel that the portability and maintanabilty of Java
>is hard to ignore.
>
>My questions are:
>
>(1) Performance is quite important.  Is there a significant
>performance hit when using Java 3D as opposed to using OpenGL and C?
>
>(2) Realistically speaking, is it unreasonable to rewrite such a large
>application in Java?  Does this go outside the bounds in which Java
>was intended?

We did exactly the same thing with our VisAD visualization
system. The first version of VisAD was written in C and used
OpenGL for graphics. The C and OpenGL version still has a web
page at:

  http://www.ssec.wisc.edu/~billh/visad_c.html

It has about 100K lines of code and very complex. It used a
custom GUI library written on top of Xlib.

We started rewriting VisAD in Java in January 1996, when
JDK 1.0 first came out of beta, and now VisAD has been
rewritten in 100% Java (although it can link to scientists'
computations written in C, C++ or most commonly Fortran). It
uses Swing for its GUI, Java3D and Java2D for visualization,
and RMI for distributed objects for collaboration and
distributed computing. It is freely available from:

  http://www.ssec.wisc.edu/~billh/visad.html

Java3D performs about as well as OpenGL. The Java language
performs a bit worse than C, although there are some new Java
implementations that fix that (IBM's Linux implementation of
Java is fast, and IBM's High Performance Java is supposed to
be really fast). Java and Java3D use more memory than C and
OpenGL, although that situation is also improving.

The really good news about Java is programmer productivity,
especially in debugging. The Java implementation of VisAD is
by far the most complex software I have ever written (with
lots of help from others) but debugging it was trivially
easy compared to the C version of VisAD. This was because of:

1. Garbage collection eliminates most memory errors (there
   are some Java2D classes that still need explicit memory
   clean up calls).
2. Pointer errors are impossible, except for null pointer
   errors.
3. Whenever a null pointer is dereferenced or an array
   bounds is violated, the language throws an immediate
   exception including a stack dump with line numbers.

Also, platform independence is a real win for us. It really
works, although when vendors first release new Java
implementations they usually have to fix a few bugs (e.g.,
Apple is fixing some bugs in their OS X port, and still
hasn't licensed Java3D). But once a new implementation
passes the reported 200K compliance tests, your application
will simply work on that implementation.

Another factor to consider is that over 70% of universities
world wide teach Java as their primary programming language.
And most handheld devices (which will be the bulk of the
Internet in a few years) are going to Java. My attitude is
catch the wave.

Cheers,
Bill Hibbard
hibbard@facstaff.wisc.edu

Post a follow-up to this message


 

©2001 Google