2D Games using OpenGL, JOGL or LWJGL?

Like the title said, I would like to port my game graphics engine to use OpenGL to gain more performance.
So far that I know, libraries that used OpenGL are JOGL and LWJGL, any other else?

And the question is, which one should I use? I’m making 2D games, not 3D.
I know LWJGL could make 2D games, but don’t know for sure JOGL could make 2D or not.
Which one is better? And how much performance could I gain from porting my Java2D to that OpenGL?
So far I got 200+ fps on my GeForce NVidia 128 megs, but on old pc, it only got 30 fps, that’s why I’m trying to port it to OpenGL.

I would like to know any comments from anyone that have use it, before i dig deeper on one of that. The upside and downside of using both.
Or perhaps Java3D, Xith3D, jME, and else could make 2D games too?
The important thing that I would like to know are: which one is faster, easier to use/code, less bugs, active developed, and especially is it right to make 2D games from it or not.
Also last thing, I hear in 1.5 Java2D is using OpenGL too, is it still make sense to port my graphics engine right now?

Thank you very much guys

I found 1.5 java2D GL pipeline to be fine for 2D gaming. See GoSub in my signature. (home page for zip, if you want to test GL accelerated version)
Nevertheless, some restrictions (no accelerated additive blending, for example) can be no-go.
Depending on the game, it might not be worth going down to GL. Nevertheless, i would not encourage to devellop games for short term to be run with 1.5GL pipeline. It is too immature at the moment.

By the way, what are that ‘old’ machine specs? Isn’t 30fps enough for your game to be playable, or it’s just that you’d love to have better framerates?

Have you considered Xith3D?

If you get 30 fps on an old pc then it might be for another reason other than Java2D. It might be a hardware acceleration issue.

Wow thanks for the fast response :slight_smile:

@pepe Hmm… Then it is true that 1.5 Java2D will use GL pipeline, great!
Currently I use 1.4.1 (waiting for 1.5 to be gold before download it), so I can’t test the 1.5 GL, but I’ll try the zip, thanks.

I use 50 fps for default, and I use animation/movement based on game loop (update), if the fps drop, the animation/movement will also drop.
The specs is not too old I think, the processor is PIII with 128 Megs RAM, but I don’t know the graphics card, got 30 fps.
And also on my friend P-IV 2.26 GHz, 128 MB RAM, unknown gfx card (perhaps onboard), the fps is lower, 25-30 fps.
Anyway is there any difference performance between running on J2SE with running on J2RE??

Ehmmm… don’t you have any comments on JOGL or LWJGL?

@TheAnalogKid is Xith3D can do 2D games? Is it better than JOGL and LWJGL? What is the upside of Xith3D?

Thanks guys

capping FPS = evil
at least to me

capping FPS != evil
running animation based on fixed FPS == evil

Kev

lol, that’s what I do right now
Running animation based on fixed FPS == evil
I’m == evil ;D
Any article on this field, whoops out of topic
Any comments about JOGL and LWJGL

Yeah, despite what people may say, Jogl is still far too buggy and unreliable. :stuck_out_tongue: LWJGL keeps it simple and reliable.

[quote]And how much performance could I gain from porting my Java2D to that OpenGL?
[/quote]
Depends on what your doing. If your getting hw acceleration with your Java2D game, then porting it to opengl won’t make ut much faster. It’s also alot of work to get it to run fast in opengl. Old computer might not run opengl because of missing/broken drivers. So only consider opengl if you know you really need the improved features.

I like LWJGL. Easy to use and got everything I need.

[quote]capping FPS = evil
at least to me
[/quote]
Uhm… no. Why?

Drawing more frames than hz is a wast of cpu power. It’s pointless and you’ll run easier into GC pauses that way.

Framecapping works really well with a high precision timer. Especially if you use a self adjusting method (see lwjgl’s sync2 method).

Okay then it settled now, I will learn LWJGL. :wink:
Less buggy, reliable, easier to use, simple, that’s what I needed! despite of I will gain performance or not, but it always nice learn new things, and OpenGL is always in my mind from long ago :slight_smile:
All right LWJGL here I come!! ;D
Oops one thing, I know LWJGL can do 2D games, but is it right doing 2D games using LWJGL?
Any big troubles will I face later? Cos I know LWJGL is intended for 3D games.
Or for simplifying things, are there many 2D games is using LWJGL out there, and what’s the most common problems arise while using it to make 2D games.

Thanks a million guys

Note to self: I better google how to code animation that not depends on fps :stuck_out_tongue:

LWJGL is intended for any kinds of games! Both my games are 2D.

Alien Flux
Super Elvis (WIP)

Cas :slight_smile:

Fantastic!!
Thanks a lot guys, I’ll digging LWJGL right now.

[quote]

That was I intended, really :slight_smile:

[quote]capping FPS != evil
running animation based on fixed FPS == evil

Kev
[/quote]
Getting slightly back to topic here.

Kev, I was reading your SpaceInvaders refactoring/OpenGL article and you said:
The only downside of the LWJGL is that you need to buy into all of the ideas behind the library or none of them. Assuming you agree with everything the library has been written around then this isn’t a problem.

This kind of implies to me that maybe you don’t agree with everything the library was written around. I was wondering if you could do into more detail about this?

Or at least what you mean by “the ideas behind the library”?

I’m not looking for an argument. I’m a newbie and I’m interested in knowing about the pros & cons of LWJGL.

Sure, am I’d hope Cas/Matzon/Elias would’nt mind me saying this:

LWJGL has taken some steps to “tailor” what they provide to games development. For instance LWJGL has removed a bunch of GL calls that you most likely don’t want to use in your games. When a decision is taken on changing the API its done in the direction of games development, or at least the perceived (sp?) view of games development.

This is why:

  1. LWJGL is driven so far so fast and changes so rapidly.
  2. LWJGL is not the same as JOGL, providing far more functionality.
  3. LWJGL will do pretty much everything for you game.

This does mean that should you use LWJGL (correctly), i.e. you use it for visuals, audio and control, then your game becomes hugely dependant on changes/improvements to LWJGL.

I’d like to say at this point that in the tutorial I’ve attempted to be objective as possible and not put too much personal opinion in there. What I was attempting to say was that assuming you don’t mind having some of your decisions made for you by people that actually take the time to think about it (LWJGL team) then LWJGL is fine. If you’re someone with enough time to take every decision in games development for yourself then (and you’d prefer it that way) then maybe its not for you.

<personal_opinion>
At the current time LWJGL is in fact my preferred option when developing anything. One of the reasons I’m not doing any Xith stuff at the moment is that I’d like to use the LWJGL version once its stable.

To me, if you’re writing a 2D game at the moment then the best choice is LWJGL. If you’re ready for a learning curve then you can do much worse than jumping for SPGL (although I would say this isn’t really for the learner).

And finally :slight_smile: On a purely selfish whim, while I think its cool that we’re seeing lots of 3D games attempts I’d really recommend working in 2D if you’re a single person. I only say this through bitter experience (see my projects page).

  1. Sprites you can get. Models are harder to find.
  2. 2D display/control/collision is easier to make fun.
  3. 3D style effects in 2D are very cool :wink:

</personal_opinion>

Kev