Sign in to follow this  

[java] Current state of 3D in Java?

This topic is 3666 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

If I want to write reasonably well performing 3D in Java, with a minimal necessary installable, what is the current story? Is Java3D part of the JRE these days, or does it require a separate download? I'm assuming this is the javax.media.j3d package? Which of jogl or lwjgl are better maintained? More ported? Does any of them run on cell phones at all? I've googled around a bit, but it seems that this "state of the world" information isn't captured anywhere except in programmers' heads. Be kind and share, so I don't have to find a head to open and take a look myself ;-)

Share this post


Link to post
Share on other sites
Last time I looked at java they had given up on J3d(that was their own 3d api) and gone with including opengl bindings. JOGL is the Sun developed bindings so I would think they are a little more blessed than lwjgl. JOGL seems to have better documentation as well. They both only support the big 3(JOGL also supports solaris) as far as oses go. They are both a separate download

Share this post


Link to post
Share on other sites
Java3D seems to be in the process of deprecation, in favour of JOGL, and as far as I can tell, if you want OpenGL on anything other than Mac, Windows, and fairly vanilla Linux, neither LWJGL nor JOGL are going to help you.

Both LWJGL and JOGL are a pain to install, at least as far as the Mac is concerned - I haven't tried on Windows. Neither is well documented, but are pretty much straightforward wrappers (apart from using byte buffers instead of pointers) of the C API.

Share this post


Link to post
Share on other sites
I think JOGL would be the best choice for 3D in JAVA, but I don't see why it would be a pain to install on a Mac. I've been using it on my Mac for about a year now and as I remember correct it just needed some extra JAR (besides the usual files native to the OS) to support it. Before using it on a Mac I have been using it for two years now on Windows and Linux systems, which was also very straight forward and it performs great!

As far as using JOGL for a project on a cell phone is concerned: I don't think it is possible yet. I haven't actually looked into it yet, but I do not assume they have a port for it using OpenGL SE at this moment. I am planning to do a 3D project on cell phones somewhere next year, so I will be looking more into that in the near future.

Share this post


Link to post
Share on other sites
Quote:
Last time I looked at java they had given up on J3d


Well, that seems to depend on who you're asking. Java3D seems to still be developed; it's now a part of the Java community site, but it's not default part of the J2SE install (and neither is JOGL AFAICT).

The problem is, if I go with JOGL, I'll need to write model loaders and texture loaders and shader handling all by myself -- and I'll have the same OGL compatibility problems that a C++ OGL program would have, especially on Vista. Isn't there something better?

(And please don't say Multiverse :-)

Share this post


Link to post
Share on other sites
JOGL's a mature, efficient, and useful library... moreso than the alternatives. But you're right; it's too low-level. The lesson to be learned from things like Java3D, OpenInventor and the like is that it's nearly impossible to develop a graphics engine which is high-level, general, and efficient. I've heard murmurs about Xith3D; might be worth a look.

Share this post


Link to post
Share on other sites
I think it's totally possible to develop a high-level engine that is efficient. Look, for example, at CryEngine, Unreal Engine or Id Tech :-) And, for those with less money, something like C4 Engine. The key is to not believe that the world looks like OpenInventor (or even Performer, or Vega).

I'm looking at Xith3D and jMonkeyEngine right now. Does anyone have experience with those engines, and can compare/contrast?

Share this post


Link to post
Share on other sites
If you're wanting to do a game (ie. single window, possibly fullscreen, requires precise timing) then LWJGL is probably you better bet. It tends to be more stable than Jogl (particularly at fullscreen) and bug reports get taken seriously and handled quickly. If you're doing a more traditional app which requires a proper GUI toolkit the choice is more difficult, but I'd still side with LWJGL, as you can still embed it in a Swing, AWT or SWT window.

If you're after something higher level, then you've got Slick (high level 2d api over the top of LWJGL), Xith3d (high level 3d api based on the Java3D api) or JME (high level 3d api).

Xith started as an open source reimplementation of Java3d when Java3d looked like it was going down the tubes, but has diverged a bit now. IIRC the two main authors have left and it's not very actively developed. JME is actively developed and seems to have a lot of users. It's api seems to be more geared towards games (ie. with things like terrain nodes) rather than a overly generalised 3d api. IIRC JME is written on top of LWJGL and Xith has both Jogl and LWJGL back ends.

Or if you want to go old school, theres jpct, which is a software renderer which works on 1.1 (ie. good for applets) but also has a LWJGL back end.

IMHO you'd be best with LWJGL, or JME if you want something higher level.

Share this post


Link to post
Share on other sites
I touched on this briefly in my journal and here if it helps at all. Basically, Java3D is okay if you never plan on mixing any Swing components with it and is easy to use. I've been using JOGL with moderate success but I've been warned of potential problems with fullscreen mode.

Share this post


Link to post
Share on other sites
jMonkeyEngine seems to be closest to what I'm looking for. Hey, it even supports COLLADA!

I'm trying to find out how big the required install is. Also, I wonder if it can be totally installed from a browser object tag, or whether an actual executable/msi has to be installed and run.

Share this post


Link to post
Share on other sites
Quote:
Original post by hplus0603
jMonkeyEngine seems to be closest to what I'm looking for. Hey, it even supports COLLADA!

I'm trying to find out how big the required install is. Also, I wonder if it can be totally installed from a browser object tag, or whether an actual executable/msi has to be installed and run.

Last time I checked it's distributed as a normal library (ie. a bunch of jars) so you don't need any kind of installer. Of course since it uses LWJGL you'll need permissions to load a native library, which means if you want to launch it from a browser you can use either webstart or an applet, but you'll have to sign it.

Share this post


Link to post
Share on other sites
Quote:
Original post by hplus0603
Quote:
Last time I looked at java they had given up on J3d


Well, that seems to depend on who you're asking. Java3D seems to still be developed; it's now a part of the Java community site, but it's not default part of the J2SE install (and neither is JOGL AFAICT).

The problem is, if I go with JOGL, I'll need to write model loaders and texture loaders and shader handling all by myself -- and I'll have the same OGL compatibility problems that a C++ OGL program would have, especially on Vista. Isn't there something better?

(And please don't say Multiverse :-)


I don't think that JOGL or Java3D be a part of J2SE in the near future, since they aren't as widely needed for everyday applications. I think that Sun is happy with it being a seperate download.

You are correct about Java3D, it is still being developed and is very slowly being fixed. Future iterations of Java3D are supposed to allow low level access to JOGL, as well as a couple other things, which will help somewhat, but I think that it will be several years down the road (if at all) before Java3D will be very good.

Greggles

Share this post


Link to post
Share on other sites
I've been using JOGL and it's been quite good. I've only come acrossed one real problem with it, and that's their insistence on putting checks for direct byte buffers and correct state inside say, the glDrawElements call. I found this to end up taking ~20% of the frame time (even with an extremely simple scene) until I ripped it out.

Unfortunately, I'm still left with a Java method calling a native method as it's very difficult to remove it. E.g:

public void glDrawElements(int mode, int count, int type, long indices_buffer_offset)
{
glDrawElements0(mode, count, type, indices_buffer_offset);
}

private native void glDrawElements0(int mode, int count, int type, long indices_buffer_offset);


There's another glDrawElements that takes a Buffer object instead of the long.

Regards
elFarto

Share this post


Link to post
Share on other sites

This topic is 3666 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this