Java-Gaming.org    
Featured games (78)
games approved by the League of Dukes
Games in Showcase (429)
Games in Android Showcase (89)
games submitted by our members
Games in WIP (466)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2
  ignore  |  Print  
  Choosing between JOGL and LWJGL - help requested!  (Read 7727 times)
0 Members and 1 Guest are viewing this topic.
Offline Chagma

Senior Newbie





« Posted 2010-02-16 10:47:48 »

Let me start by saying that I am aware that A vs. B style threads are usually frowned upon but I feel this is the most suitable means for me to gain the knowledge I require.

We are about to embark on a large project using Java and OpenGL and I would appreciate some assistance on choosing between what appear to be the two main alternative libraries namely JOGL and LWJGL.

I am no expert on either of these but the main differences appear to be that JOGL has a larger footprint (which is undesirable but not necessarily a problem) and seems to have better in-built text rendering support (through the TextRenderer class) although it lacks any support for audio.  From comments on these and other forums it appears that LWJGL may be better supported and perhaps have a more promising longer term outlook.  Integration with either Swing and/or Java2D seems limited or non-existent in both libraries despite JOGL touting the Java2D/JOGL interoperability bridge (as this is profoundly broken).

Our requirements are basically for full access to OpenGL functionality from Java and this includes a need for good (excellent?) quality text rendering and effects.  The text will need to be scalable a-la vector graphics and be very legible at smaller font sizes.  The deployment method will be Java applets loaded using JNLP (yes true applets in a browser, not apps) so the library must work well in that environment.  Performance is critical of course but I am guess there's probably not much to distinguish the two libraries on that basis.

So, what are your thoughts on the two libraries and which do you feel would be the best fit for our requirements?  Are there perhaps other alternatives I am yet to encounter?
Offline Orangy Tang

JGO Kernel


Medals: 51
Projects: 11


Monkey for a head


« Reply #1 - Posted 2010-02-16 11:08:08 »

Fonts are not really something an OpenGL access layer should be concerned with, so I don't think you should be basing your decision on the built-in font capabilities of either library.

That said, it depends on whether you feel confident about writing your own font rendering system or would like to use an existing one. Jogl's font renderer basically just uses J2D to draw text and copies it to a texture for OpenGL display, so you could port that to LWJGL without too much difficulty.

Proper scalable fonts that work in both large and small sizes are technically difficult though, search the forums and there's some interesting stuff

http://www.java-gaming.org/topics/zshapes-resolution-independent-curve-rendering/14778/view.html
http://www.java-gaming.org/topics/valve-s-vector-text-rendering-method/18479/view.html

There's also Slick which has font rendering (albeit bitmap based so scaling may not be of great quality http://slick.cokeandcode.com/ ) and there's a few other gui libraries around which I can't find links for atm.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline ryanm

Senior Member


Projects: 1


Used to be bleb


« Reply #2 - Posted 2010-02-16 14:08:22 »

Distance field rendering (the technique in OrangyTang's second link) works pretty well. Have a play on this webstart to get a feel for it.

Up and down to change the input font size, left and right to change the font.
Hitting space will cycle through rendering the raw texture, using the shader, and using the alpha-test fallback mode.
Hitting the left control key will toggle between distance-field and standard texture font rendering.
The last-typed character is rendered at 1/4, 1/2, x1, x2 and x4 scale, and then as large as will fit on the screen.
There's also a console that you can use to play around with the parameters of distance field generation - hit the grave key to activate it, "printconf" to see what's what, tab to autocomplete/get completion suggestions.

The code for this is freely available (webstart main class here, but the bit you'll be needing, and can easily extract without bringing the kitchen sink with it, is here)
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline JL235

JGO Coder


Medals: 10



« Reply #3 - Posted 2010-02-16 15:35:31 »

It's not a huge advantage but because JOGL is signed by Sun it requires no certificates for the user to view (they are trusted by default). I believe LWJGL does which the user then needs to accept.

The TextRenderer in JOGL works and it does decent text. But it's far from perfect. First I've had multiple huge memory leaks because of how I've used the class and have since written management code on top to help handle it (namely that they don't seem to clean up their memory when you dispose them, so you should only have a limited number). I personally would like to replace it with something else. Second I've had a user who has said that some bits of text in one of my games was rendered multiple times, and some not at all. The rest of the graphics were not affected, only the bits using the TextRenderer (although this doesn't mean the TextRenderer is at fault in any way).

There is no reason why you can't use it, but IMHO if you have an alternative then you should use it.

Offline Orangy Tang

JGO Kernel


Medals: 51
Projects: 11


Monkey for a head


« Reply #4 - Posted 2010-02-16 15:45:10 »

It's not a huge advantage but because JOGL is signed by Sun it requires no certificates for the user to view (they are trusted by default). I believe LWJGL does which the user then needs to accept.

Jogl is no longer signed by Sun since they ditched the project.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline princec

JGO Kernel


Medals: 284
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #5 - Posted 2010-02-16 16:22:12 »

Signing isn't really a big deal anyway, if you pay for a certificate. If the user wants or needs the content, they'll click Yes.

Cas Smiley

Offline JL235

JGO Coder


Medals: 10



« Reply #6 - Posted 2010-02-16 16:57:21 »

Jogl is no longer signed by Sun since they ditched the project.
Will that affect current and older versions?

Offline Riven
« League of Dukes »

JGO Overlord


Medals: 613
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #7 - Posted 2010-02-16 16:58:45 »

Will that affect current and older versions?

Even with older versions, by the time you finish your project, the certificate will probably have expired.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Nate

JGO Kernel


Medals: 129
Projects: 3
Exp: 14 years


Esoteric Software


« Reply #8 - Posted 2010-02-16 17:15:44 »

http://www.java-gaming.org/topics/jogl-java2d-opengl-bridge-does-it-actually-work/21988/msg/181266/view.html#msg181266

Offline gouessej

« In padded room »



TUER


« Reply #9 - Posted 2010-02-16 17:29:48 »

JOGL does not have a large footprint and it has a better support of Linux (I have already posted one screen capture of a bug that has not been fixed for years in LWJGL and that has been reproducible on ALL Linux machines I tested, whatever the kernel version, Xorg version, window manager version, etc...). Sorry to speak once again about it but I have found no Linux machine that does not suffer of these broken desktop with straight lines on the task bar and in the background after using a LWJGL application that relies on the exclusive full-screen mode.

JOGL is used in the industry, in some scientific researches and in a few commercial games including Wakfu.

However, I am currently fixing a memory leak in the famous text helper called "TextRenderer", it will improve the memory footprint for sure  Smiley (it is a matter of days, I need to repair this at work).

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Chagma

Senior Newbie





« Reply #10 - Posted 2010-02-16 17:59:40 »

Thanks to everyone who has commented on this.

Perhaps I emphasised the need for good font rendering too much as this is only one of the requirements we have.  It's obviously a complex problem and it appears that some of the more advanced techniques would be equally applicable to either library.

I am interested in how JOGL and LWJGL stack up against each other in all areas.  Are there any major pros and cons (apart from font rendering) that have not been touched on that I should be aware of?
Offline princec

JGO Kernel


Medals: 284
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #11 - Posted 2010-02-16 18:13:03 »

The APIs are functionally identical; they both expose pretty much everything to do with OpenGL. LWJGL is slightly closer to the original C specifications, JOGL is slightly closer to what an OOP version of GL might have looked like, were it OO. LWJGL also includes OpenAL and comes bundled with JInput, and also includes a lightweight windowing library to bypass AWT that is aimed at games programmers. Both APIs integrate with AWT well.

The main difference is in support and general reliability. LWJGL is maintained actively by interested parties. JOGL is currently in an undetermined state and if history repeats itself like it often seems to, it'll go the way of Java3D.

Cas Smiley

Offline elias4444

Junior Member





« Reply #12 - Posted 2010-02-16 18:15:43 »

EDIT: Cas hit the post button before I did, and I basically said the same thing.

So... ditto!

Offline Chagma

Senior Newbie





« Reply #13 - Posted 2010-02-16 18:41:48 »

OK, that's a good summary - thanks.

One thing I do need to know re LWJGL is can its "canvas" (or equivalent container, whatever it's called) be used in a Swing program, perhaps inside a JPanel or inside a generic JComponent?  There doesn't need to be any fancy OpenGL/Swing integration, just the need for resizing and integration with the Swing rendering system.  I know this can be done with JOGL but I am not sure about LWJGL.
Offline Orangy Tang

JGO Kernel


Medals: 51
Projects: 11


Monkey for a head


« Reply #14 - Posted 2010-02-16 18:48:02 »

Display.setParent()

http://www.lwjgl.org/javadoc/org/lwjgl/opengl/Display.html#setParent(java.awt.Canvas)

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Chagma

Senior Newbie





« Reply #15 - Posted 2010-02-16 18:57:34 »

Right, so Display is their OpenGL root container (the equivalent of GLCanvas in JOGL)?  I see that setParent() takes a Canvas object which is AWT not Swing which may be problematic.

Also, does LWJGL support multisampling?  I know JOGL does.
Offline Orangy Tang

JGO Kernel


Medals: 51
Projects: 11


Monkey for a head


« Reply #16 - Posted 2010-02-16 19:13:37 »

Right, so Display is their OpenGL root container (the equivalent of GLCanvas in JOGL)?  I see that setParent() takes a Canvas object which is AWT not Swing which may be problematic.

Also, does LWJGL support multisampling?  I know JOGL does.

Multisampling is specified in the PixelFormat when creating a display:
http://www.lwjgl.org/javadoc/org/lwjgl/opengl/PixelFormat.html

Canvas being heavyweight hasn't caused problems when I've used it, because typically you're not overlapping any lightweight components (other than menus and popups, which can obviously be fixed with the appropriate Swing hint).

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline dishmoth
« Reply #17 - Posted 2010-02-16 19:26:37 »

The APIs are functionally identical; they both expose pretty much everything to do with OpenGL. LWJGL is slightly closer to the original C specifications, JOGL is slightly closer to what an OOP version of GL might have looked like, were it OO. LWJGL also includes OpenAL and comes bundled with JInput, and also includes a lightweight windowing library to bypass AWT that is aimed at games programmers. Both APIs integrate with AWT well.

Presumably the idea of merging JOGL and LWJGL was abandoned because it wouldn't leave anything for JGO users to squabble pointlessly over...?

Offline princec

JGO Kernel


Medals: 284
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #18 - Posted 2010-02-16 19:40:44 »

Aye. JOGL also conveniently croaked, probably for the best, as there won't be any more time wasted on it Wink

Cas Smiley

Offline gouessej

« In padded room »



TUER


« Reply #19 - Posted 2010-02-17 10:05:57 »

Aye. JOGL also conveniently croaked, probably for the best, as there won't be any more time wasted on it Wink

Cas Smiley
This is simply wrong. JOGL is alive. 3 people (including me sometimes) are still maintaining it.

Presumably the idea of merging JOGL and LWJGL was abandoned because it wouldn't leave anything for JGO users to squabble pointlessly over...?

Mickael only said it is better to have some choices.

The main difference is in support and general reliability. LWJGL is maintained actively by interested parties. JOGL is currently in an undetermined state and if history repeats itself like it often seems to, it'll go the way of Java3D.

Cas Smiley
JOGL is still actively maintained and it is not in an undetermined state. It is a community project that is still used in some 3D engines (Ardor3D, JMonkeyEngine, Xith3D, Aviatrix3D, ...). Stop FUD now please.

Mickael is working hard on JOCL. JOGL and JOCL can work together nicely Smiley

Offline Chagma

Senior Newbie





« Reply #20 - Posted 2010-02-17 10:09:30 »

OK, how many people are maintaining LWJGL for comparison?
Offline gouessej

« In padded room »



TUER


« Reply #21 - Posted 2010-02-17 10:15:30 »

OK, how many people are maintaining LWJGL for comparison?
I don't know but they have no bug tracker and in my humble opinion, when it comes to Linux, they often quickly conclude the bug comes from the driver rather than their library... It happened at least twice in the past, I succeeded in proving once than I was right. Look at the LWJGL section here:
http://www.java-gaming.org/topics/lwjgl-example-doesn-t-work-under-linux-with-ati-radeon-9250-pro/19786/view.html

Offline Chagma

Senior Newbie





« Reply #22 - Posted 2010-02-17 10:28:06 »

This is proving to be a very difficult choice indeed!  There are pros and ons on both sides of the equation.  I guess I am concerned about the long term future of JOGL but that may be only a result of FUD as you say.  On the contrary, if the LWJGL team are not prepared to acknowledge bugs/faults in their own product and instead shift blame to external factors then that's a real worry too.

In the end I want something which just works (at least 90% of them time!), is supported, has a reasonable long term future and has the functionality I need it to have.  There doesn't seem to be anything in it on the functionality side so I guess it's going to come down to which library makes the most sensible and safe business decision.

That part is not so obvious, at least not yet.
Offline princec

JGO Kernel


Medals: 284
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #23 - Posted 2010-02-17 10:49:55 »

Actually I think what that post tells you is that the LWJGL devs are extremely quick and thorough and responsive when we get any bug reports, at all. We fix things as fast as possible and do a new release as soon as we can, as opposed to JOGL, which has been apparently frozen for quite some time.

And yes, gouessej does present some unusually pathological cases with weird versions of Linux with ancient graphics cards and OpenGL drivers. LWJGL is committed to providing stability for the vast masses and if we can't reproduce bugs because they're on fringe hardware the only solution is for gouessej to fix them himself and commit a patch once he's found out what's wrong. However, as we maintain, most of his problems come from buggy drivers (for example, his repeatedly documented display corruption from LWJGL fullscreen applications should simply not be possible from a desktop application, yet instead of bugging the driver writers he keeps hassling us instead - and so it will never be fixed).

Business wise, LWJGL is in safe hands. At the very least it's the foundation for Puppygames.

A list of contributors can be found on http://lwjgl.org/credits.php - we are many. The bulk of the coding work was performed by underground Danes, who receiving almost no visible sunlight for most of the year, have little better to do except maintain OpenGL bindings. These days much of the work is done by Spasi of these parts, who being Greek, has to turn out a monumental effort just to get out of bed most days let alone turn the computer on, yet somehow he has implemented all the OpenGL interfaces since 2.0 or something.

Cas Smiley

Offline dishmoth
« Reply #24 - Posted 2010-02-17 10:52:12 »

Mickael only said it is better to have some choices.

Yes, you get to choose which side to be on in a pointless flame war.

Offline gouessej

« In padded room »



TUER


« Reply #25 - Posted 2010-02-17 11:28:08 »

And yes, gouessej does present some unusually pathological cases with weird versions of Linux with ancient graphics cards and OpenGL drivers.
No! I have asked some people to test on recent machines (gamers machines with some very recent ATI graphics cards) and I have tested at work with my workstation (NVIDIA Quadro FX, Intel Core 2 Duo, CentOS 5.3). I have tested with several distros, Ubuntu, KUbuntu, CentOS, Mandriva, Fedora, the results is the same. I have tested both with Gnome and KDE, the result is the same. I'm fed up with repeating the same thing.

Chagma, I encourage you to check it by yourself with a Live CD, it is highly probable that you will reproduce this bug.

Yes, you get to choose which side to be on in a pointless flame war.

This is not my decision, this is Michael's decision.

Concerning the maintenance, there are 3 people that share most of the job but there are some occasional contributors too. JOGL needs less maintenance effort because some painful steps have been automatized, the code that deals with JNI is generated, it does not use any hand-written template. Kenneth Bradley Russell now works for Google and as far as I know, he does not work on JOGL anymore. Sven Goethel left Sun some months ago and is currently a bit busy. Michael is very busy with JOCL.

Offline Nate

JGO Kernel


Medals: 129
Projects: 3
Exp: 14 years


Esoteric Software


« Reply #26 - Posted 2010-02-17 11:36:24 »

This more like a flame pillow fight. Wink

LWJGL FTW!

Offline jezek2
« Reply #27 - Posted 2010-02-17 11:56:08 »

No! I have asked some people to test on recent machines (gamers machines with some very recent ATI graphics cards) and I have tested at work with my workstation (NVIDIA Quadro FX, Intel Core 2 Duo, CentOS 5.3). I have tested with several distros, Ubuntu, KUbuntu, CentOS, Mandriva, Fedora, the results is the same. I have tested both with Gnome and KDE, the result is the same. I'm fed up with repeating the same thing.

That's interesting, there is quite high variety in your tests. What is your exact testing procedure? Weird thing is that I didn't observe such thing, nor did any of my users mentioned it to me. Also didn't saw anything like that from anyone other on this or other forums.
Offline princec

JGO Kernel


Medals: 284
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #28 - Posted 2010-02-17 12:03:46 »

No reports either from any of the several thousand Linux players of my games. Except gouessej.

Cas Smiley

Offline gouessej

« In padded room »



TUER


« Reply #29 - Posted 2010-02-17 13:27:14 »

That's interesting, there is quite high variety in your tests. What is your exact testing procedure? Weird thing is that I didn't observe such thing, nor did any of my users mentioned it to me. Also didn't saw anything like that from anyone other on this or other forums.
We test the demos on lwjgl.org, especially "FullScreenWindowedTest". When we have some more time, we test some free demos including Puppy games. We are already 3 programmers to experience this problem with completely different hardwares. The only workaround I have found is to force AWT to reset the good display mode.

Pages: [1] 2
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (80 views)
2014-04-15 18:08:23

BurntPizza (72 views)
2014-04-15 03:46:01

UprightPath (83 views)
2014-04-14 17:39:50

UprightPath (67 views)
2014-04-14 17:35:47

Porlus (83 views)
2014-04-14 15:48:38

tom_mai78101 (107 views)
2014-04-10 04:04:31

BurntPizza (167 views)
2014-04-08 23:06:04

tom_mai78101 (263 views)
2014-04-05 13:34:39

trollwarrior1 (213 views)
2014-04-04 12:06:45

CJLetsGame (222 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!