"best" java graphics library for gaming?
Hey all,
I was just wondering, what do u guys personally thing is the "best" graphics library for gaming? Until recently I've been using java2d, but its extremely slow and inefficient, and its hard to do nice cool effects with it without it becoming laggy. I tried out jogl, but OpenGL is extremely convoluted. What are the other Libraries?
I know that u cant rly rate something without criteria, so here are some:
Effficiency(is it memory efficient? does it lag? can you run things like 50 times per second efficiently?)
Ease of Use(is it easy to use? how long does it take to learn?)
Library's Power (ie what can u do with the library? how powerful is it?)
Ease of deployment (Ie 4 jogl steps are needed to ensure that clients will be able to use jogl)
etc (sorry idk any more criteria on the top of my head, ill think up of some l8er)
I just want to compare and contrast the libraries, and i thought the gaming forum would be experienced with messing around with alternate libraries.
[1043 byte] By [
Astrofa] at [2007-11-27 2:13:04]

# 1
> Hey all,
> I was just wondering, what do u guys personally thing
> is the "best" graphics library for gaming? Until
> recently I've been using java2d, but its extremely
> slow and inefficient,
How did you come to the conclusion that it's the Java 2D classes that are slow and not your own code?
# 2
Well i try to run things at 30fps or 50fps, and with java 2d this requires running the paint method 50times per second, which is extremely laggy. Also I couldnt effectively use gradients without it lagging (i had to make my own pseudogradient method) Also, this is a random example, on one game i tried using BufferedImages (as BufferedImages had many methods that i wanted to utilize (getSubimage(), etc), but were very very inefficient to draw 50times per second.
# 3
The most versatile way is to use an openGL binding, such as LWJGL or JOGL. There are certain hacks that you can use in Java2D to speed things up, but it will never reach the speed that hardware acceleration will give you.
Unfortunately about openGL, you're right, your code will start to look convoluted after a while, but as long as the structure is clear in your head, it shouldn't be that bad.
Out of the two bindings mentioned above: I find LWJGL easier to use and learn.
Good luck on your game
-Cuppo
# 4
hmm but doest LWJGL use its own frames and such (like isnt it incompatible with swing?) the reason i tried Jogl was because it could work with swing.
# 5
It's true that JOGL supports Swing while LWJGL doesn't.
(Actually this isn't entirely true. LWJGL actually has a class designed around Swing support, but JOGL was designed from the ground up for Swing)
However, I found that even though JOGL supports Swing, this feature is rarely used in games.
You cannot use Swing components inside a JOGL pane (i think, correct me if i'm wrong). So in order to use Swing components, you'll have your main game window, and then some side panels with Swing buttons and the like.
I personally consider this very tacky looking and unprofessional (what game has displays it's buttons outside of the game window?) and I would never use it, so Swing support was never a big concern of mine.
-Cuppo
# 6
I guess its just im used to swing. I tried using the NEHE tutorial to learn OpenGL, but it got rly boring. hmm but i might try LWJGL, are there any other good libraries out there?
# 7
The NEHE tutorials are really good to get you started... you may find them boring...but it's the same for any package. There is no substitute for hard work.
There are two openGL bindings in Java
-LWJGL and JOGL
-my preference is LWJGL
There are three scenegraph engines that I know of
-jME
-Xith3D
-Java3D
-my preference is jME, but i don't like using pre-programmed scenegraphs anyway.
# 8
whats a scenegraph? cuz i tried to look at java3d, but it was kinda weird (the whole universe thing....)
and i head that java3d uses directx and/or opengl?
oh, and i want to thank you for your help. You're the person who has really answered, and i want to thank you for that Cuppo!
# 9
openGL commands are like this:
changeColor( color)
drawTriangles( pointA, pointB, pointC)
scenegraph commands are like this:
initiateWorld( worldData )
Shape shape = new Shape( shapeData )
world.drawShape( shape )
It's a higher-level implementation of 3D. Kind of like assembly vs. Java.
To answer your question: ALL scenegraphs use directx/openGL. But some of them use more, and some use less. This affects the speed and portability that each package has.
Anyway, this information should get you started. And if you have more questions, you should have some search terms that you can google for now.
Thanks for reading. I'm glad that I helped someone
-Cuppo
# 10
I'm thinking about starting to program Java games. Should I start with Java3D? Is jME independent of any other libraries?Thanks. :)
# 11
Hi,
I would not personally use Java3D. It's a little outdated, and I find it cumbersome and not intuitive.
I don't understand your question about jME.
jME is a scenegraph engine built on LWJGL.
I don't know how much programming experience you have. But if you don't have any, or if you have limited experience, I would highly recommend following the steps that I outlined.
Good luck
-Cuppo