The Source for Java Technology Collaboration
User: Password:



Chris Campbell

Chris Campbell's Blog

Co-existence of Java 2D, Java3D, JOGL, and Mac-n-Cheese

Posted by campbell on July 28, 2003 at 09:46 PM | Comments (6)

[I was going to reply to Chris's excellent weblog in the talkback section, but I started rambling and it touched on some other thoughts I've had, so I decided to ramble here instead... Keep in mind that I'm only half-wearing my Sun cap right now (kind of like one of those green and brown, half A's, half Giants caps that were popular in the '89 Series), so I'm not speaking entirely on behalf of the company.]

In response to Chris Adamson's recent blog entry, The End (of Java3D) and the Beginning (of JOGL):

I'd just like to point out that JOGL is not an all-out replacement for Java3D. The two can co-exist, and one could potentially rewrite the platform-specific layer of J3D to sit atop JOGL. Java3D does indeed act as an "isolation layer" for the underlying platform when a developer uses its "immediate mode" APIs, but more importantly Java3D offers a high-level scene graph API. Many educational and corporate institutions have chosen Java3D because of its scene graph offerings, in addition to the appeal of its cross-platform nature.

On the other side of the coin you have the traditional game shops, who want to get as close to the graphics platforms/hardware as possible. Many of these folks are finding JOGL a better fit because it's a lower-level API, and they can make use of their existing OpenGL knowledge/code base. So I think it depends on the type of application you're developing which API best suits your needs. The gaming community has been clamoring for official Java bindings for OpenGL for quite some time, so that's where Sun's efforts seem to be heading, but don't count Java3D out for good; it still serves its purpose quite well as a higher level 3D graphics library.

Related to this discussion, we're also starting to see some folks on the javagaming.org forums asking whether JOGL would be a better fit than Java 2D for their apps/games. Again, JOGL is not the end-all and be-all Java graphics library. Many people don't realize that OpenGL is actually an expressive 2D library, despite its tight association with the 3D world. However, there's so much more to 2D graphics than rendering lines and sprites really fast (think medical imaging, complete support for any image format or color/sample model, printing, text rendering, stable offscreen rendering, etc). This is where Java 2D really blows the proverbial socks off all the other 2D libraries out there.

My answer to those folks on javagaming.org is the same as my J3D response: Java 2D is a higher-level, easier-to-use, more robust, more full-featured 2D rendering API than JOGL. Like J3D, the two technologies can play well together (if we do our job correctly, there should be no reason why the two API's couldn't be used in the same application). Also like J3D, we use hardware-accelerated graphics libraries (such as Direct3D and OpenGL) under the hood, so for many applications, performance should be virtually the same whether you use Java 2D or JOGL. As I mentioned earlier for J3D, we could also port our OpenGL-based Java 2D pipeline to sit atop JOGL (in fact, we're exploring this idea for a future release, which should further decrease our dependence on native C code). If you want to access the very latest in hardware technology, such as programmable shaders, or if you have large data sets of vertices and you're comfortable with the increased complexity of OpenGL, then JOGL would certainly be a better fit.

So the choice is yours... Each API has its benefits; it's up to you to evaluate which one is best-suited for your next project!


Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • but...
    after reading both postings in one go, yours feels like it is defending the quality of J3D on merits that it is there. And not much more.
    After many people have complained about Suns lack of moving forward with J3D and the conclusion that Sun is not stating it will be moving forward its a API without development in a fast changing market. Any developer will tell you that that is not a pretty sight.

    All in all your story only holds shallow words while actions are the only answer to the original posters message.

    You should know that stating its a good platform that will be around for awile is a dangarous thing to do; it will backfire when the common maintainance will not take place soon. Better be upfront with things, or people will loose trust in everything Sun does! But that is just common sense, naturally.

    Posted by: zander on July 29, 2003 at 03:32 AM

  • Re: but...
    I don't think that's fair. I wrote the original weblog that Chris C. is responding to and I think he brings up a lot of important points, namely:
    * that JOGL is low-level, which is good for game developers but hard on other developers
    * that Java3D or some other higher-level API could be written atop JOGL, reducing native-code requirements in the higher-level API.
    * that JOGL also exposes OpenGL's 2D graphics capabilities

    The 2D analogy is particularly shrewd. There are different needs for 2D graphics: a game developer needs sprites and fast redraws of clip regions, someone doing an Photoshop-like app needs curves, stroking, fills, and gradients, while someone working with video needs fast redraws of the entire window and possibly some fast color space conversion (eg, from a camera's YUV to the screen's RGB). A low-level API may be useful both as the direct means to do 2D, and as the building blocks for higher-level API's for these audiences.

    As for 3D, my point was that Java3D support had seemed to be waning for some time, and that the OpenGL announcement provides a new, albeit different, direction. What I think Chris C. is saying is that this doesn't _necessarily_ preclude a future for Java3D.

    --Chris Adamson (invalidname)

    Posted by: invalidname on July 29, 2003 at 06:36 AM

  • Re: but...
    > What I think Chris C. is saying is that this doesn't
    > _necessarily_ preclude a future for Java3D.

    I understood that as well; and that is exactly what I wanted to address in my reply.

    > * that Java3D or some other higher-level API could be
    > written atop JOGL, reducing native-code requirements
    > in the higher-level API.

    Yes, it can. And that is just the trick; coming from a Sun employee this is very short from a promise that it actually will happen. Please do remember that nobody but Sun is able to actually implement this. So while the J3D idea ontop of XYZ seems nice and possible; you are at the merit of Sun.
    And you yourself have pointed out that Sun is not really moving in that direction.

    So I really stand by my point that the blog entry above is nothing but nice words that sound (to me) a bit too shallow.

    Hope that explains my POV a bit better.

    Posted by: zander on July 30, 2003 at 12:34 AM

  • ... no buts
    The point to note is the scenegraph technology in Java3d.
    It is efficient, high-level, data-driven and so easy a rookie software engineer can be trained in 4 months. No previous education in java or computer graphics. Try that with plain OGL or D3D.
    That’s why Java3d has been so fit for simulation, academics and research – my field.
    The software world is not only about games, and the scenegraph ‘niche’ could be enough to keep Java3d evolving. After all, this niche (simulation, academics, research) is about some hundred thousands of potential developers, sure mostly not full time, but quite a niche it is...
    Just exploit the hooks for general programming of the GPU with HLSL (java algebra api for the GPU?) and we are set for another 3 years of development.
    Regards,
    antonio

    Posted by: antoniocacho on August 13, 2003 at 05:11 AM

  • 2D over abstraction?
    At the moment we have 3, maybe more, choice of how to implement a sprite based game in Java.

    a) Java2D + AWT - gives the smallest foot print, but (currently) doesn't perform consistantly on different platforms. Also performance for anything non-trivial is an issue.

    b) JOGL + AWT - gives a large foot print and a dependancy on a native library. Although performance is better.

    c) LWJGL - gives a large foot print, but we can remove AWT from that. Again we're dependant on a native library and not one that SUN has anything to do with (No offense Cas!). Input is nicely handled here too.

    Now, tbh, I'm waiting for 1.5 with its super OpenGL based Java2D. However, I want to write my sprite based games now. Thought you might be interested in this:

    http://j2da.sourceforge.net

    Its an abstraction of sprite based games sat currently ontop of a pluggable rendered. Currently we've got JOGL and Java2D. So hopefully, I can write my game now, and when 1.5 comes trotting along, just switch back to the good ole' ways..

    Posted by: kevglass on September 08, 2003 at 06:01 AM

  • OpenGL-based Java 2D pipeline to sit atop JOGL plase do it as soon as possible ... It should simplify many things ...

    Posted by: draccagni on July 05, 2005 at 02:46 AM





Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds