Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

WoolyLoach

[java] Java3D vs. GL4Java

This topic is 5941 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, I''m looking into alternatives for developing a simple, online-capable RPG and am checking into using Java for at least some of it. I''ve dug into JNI a bit (reading-wise) and it looks as if it''d be a lot easier to use something already developed than to write my own DirectX or OpenGL wrapper (or worse, implement most of the engine in C++ and expose it all to Java via JNI, which is my fallback position). I don''t need triple-digit framerates for a basic RPG, but I _do_ need at least 30fps on my target system (PIII-850MHz. with a GeForce3-class graphics card). The Java3D examples I''ve run are relatively slow, but they''re _examples_ so I''m sure they''re not optimized for performance. The GL4Java examples run fairly well but setup is a pain in the tail and I''m not sure end-users would want to deal with it all. Any comments, recommendations (URLs, books, alternatives)?

Share this post


Link to post
Share on other sites
Advertisement
Well here I go doing a shameless plug for WildTangent again. I can get framerates of about 30-31 on a duron 700 with a 4meg video card, and mind you those framrates are capped from 40-50, and thats with junky unoptimized poorly planned code, so you could probably do wonders, or set the frame-cap higher.

Share this post


Link to post
Share on other sites
Java3D does not support the latest features on modern graphics cards such as Geforce3 and gives you less control over rendering than OpenGL, but it also gives you some features (such as model loaders and view-frustrum culling) that you will have to implement yourself if you go with OpenGL. Since you have more control over the rendering with OpenGL, it can be made to perform faster than Java3D.

I think both APIs could be make a basic RPG perform at 30+ fps on the system that you describe, but our perception of ''basic RPG'' might differ. There is a online RPG called Cosm being developed using Java3D.

Share this post


Link to post
Share on other sites
Just some points and corrections.

Pro

Java3d can perform bettern than gl4java. It has an auto-optimizing scene graph that can allow you to concentrate more on you objects than the rendering pipeline. It run on DX or GL under windows.

Con

Java3D does not support Mac, gl4java does. There are rumors of java3d under mac, but nothing anyone has actually put on paper as a PR or whatever. Java3d scene graph technology is annoyingly complex almost too complex at times and is still not 100% ( two thing that should work the same operate at widly diffrent speeds ). Java3d API is fairly stable, but it is an evolving spec.

Gl4java is extremly easy to get running on a windows and linux and only slightly more difficult for a mac box. Just use the web installer, or use a webstart app.

Other things you might want to think about.

Joystick access?
Sound?
Server?

Share this post


Link to post
Share on other sites
Thanks to everyone for all the info. I''m off to the javagaming site for more research, but I think I have a better understanding of the issues involved now (read: less clueless).

Share this post


Link to post
Share on other sites
quote:
Original post by snowmoon
Just some points and corrections.

Pro

Java3d can perform bettern than gl4java. It has an auto-optimizing scene graph that can allow you to concentrate more on you objects than the rendering pipeline.


http://www.rolemaker.dk/articles/evaljava/

"Unfortunately there are also several drawbacks of using Java3D:
Significantly reduced performance compared to highly tuned OpenGL or DirectX applications. In the 3D Demo benchmark (see section 7.10) we saw that the Java3D version (Java3D 1.3 beta 1 for OpenGL was used) was about 2.5 times slower than the equivalent GL4Java version. This is a significant slow down since most of the processing time is supposed to be in 3D hardware."

and...

"Given the poor performance of Java3D I can not recommend the use of Java3D for games with high requirements in performance."

I''m not sure if the author has resolved these issues (I stopped paying attention to the Java3D-interest mailing list a while back) but they do indicate that perhaps GL4Java is the best route at present.

Java3D is great for creating things quickly (once you get the hang of the ridiculous amount of classes required for most tasks or wrap them up in simpler function calls). It will probably perform well enough on your wanted system and it will speed up development time. Note that if you are interested then have a look over at Daniel Selman''s book. The source code is over here.

Share this post


Link to post
Share on other sites
Just little quibble.. nothing agains your work jacob...

Java3d has been shown to be within 10% of gl4java ( for most TESTS ) once you understand the java3d quirks. Java3d has much room for improvement without any changed to your code. When J3d implements a T&L path your gl4java game would be left in the dust. Real world performace proves that j3d is a real cntender and it''s improvement on the deliverable bottom line is a big win too.

If it only ran on mac I could justify the learning curve over gl ( whick I already know ).

Share this post


Link to post
Share on other sites
Well, more reading and surfing about has certainly brought me wisdom, knowledge, and a screaming headache.

Since I''m _NOT_ looking for triple-digit framerates and I''d rather focus on game logic than re-inventing the wheel, Java3D is looking pretty good. My only remaining concern is how soon new hardware features will be implemented in the API - for instance, vertex and pixel shaders. I suspect it''s going to be sssslllooowww arriving in Java3D due to platform-independence issues...

It just gets more interesting as time goes on. :-/

Share this post


Link to post
Share on other sites
Basic tutorials: http://www.java3d.org
Other FAQs, lots of code: http://www.j3d.org
Free (entire) online book, source code up a level in dir:
http://www.manning.com/selman/onlinebook
Java3d-interest mailing list archives:
http://archives.java.sun.com/archives/java3d-interest.html
Stuff (including tutorials):
http://java.sun.com/products/java-media/3D/collateral/
More tutorial-related stuff:
http://java.sun.com/products/java-media/3D/collateral/class_notes/slides/mt0
000.htm

news://comp.lang.java.3d (which is a bit cack really - it''s like a ghost town... stick to the mailing list

Use the OpenGL version of Java3D because it''s faster and more stable than the Direct3D version. Read this too and note that the .compile() method for BranchGroups does not do anything with the default settings! (I think you need to setPickable(false) and setCollidable(false) for yer objects IIRC). I think that Java3D tries to combine and optimise shared appearances, etc., when you call this method. This page talks about advanced techniques.

IIRC you''ll have to wait until the next big release of Java3D before you get da shader goods. Unfortunately, that''ll be in a year or two (I forget which). There will always be feature lag with Java3D so you''ll have to grin and bear it.

Make sure you sign up for the mailing list: it''s where all the big-wigs (Java3D creators, etc.) hang out. Also, note that there are one or two undocumented ''features'' for some of the classes. One that I remember is with the Text2D class. You have to divide the scale by 256 in the setScale method, assuming I''m remember correctly. It''s not mentioned in the documents.

P.S. snowmoon, I hope you don''t think I''m Jacob .

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!