LWJGL for my 2D Game

yuck. I’m really wanting to be able to switch between the modes. It sounds like I’m going to have to have a completely separate set of code for my game set aside for the OpenGL implementation.

No, that’s exactly not what to do!

Try and imagine for a moment that a menu system is really just another bit of the universe you’re trying to draw - let’s pretend it’s a bit of “World State”.

You need an intermediary structure then that describes the “Drawable World State” which you work out only when necessary.

Then you need to create an instance of the thing that can draw the drawable world state using whatever renderer you decide upon. You’ve got two choices: a Java2D renderer and an OpenGL renderer. Largely the way they work will be very similar.

The sequence of operations is thus:

  1. When anything changes, use the World State to create a new instance of the Drawable World State (or update an existing one, when you’re at the tuning stage)

  2. Use the Drawable World State to create an instance of a Renderer that can draw it using the appropriate API.

  3. Draw using the Renderer whenever you need to.

Yes, this is complicated. No, it’s probably not worth it. You really ought to stick to one rendering API and put all your effort into making it work the best.

Cas :slight_smile:

I’ve not much to add technically (sorry).

But you’ve got a nice looking game there. Not sure what I was supposed to do though…

I feel using lwjgl should give you a big speed increase though.

Hope you get somewhere with this.

Dan.

The game was origionally designed for a phone, so I have a version of the game that can run at like 150x150 resolution and be plenty playable and attractive. So there’s a whole 'nother art set for that. Also, I have the game running as an Applet game, so that I can expand the size to about 500x500 with the lower (or higher) resolution art to hold on to 60fps easy. Similarly to having it on phones, I can have it on pda’s. Now I also want the portion that grabs this and sticks it on a Canvas in full screen mode to be able to use the high resolution graphics at 1024x768 resolution easy.

So when I change code in the games, I don’t want to have to change that code in more than one place otherwise I’ll go out of my mind.

Ideally I could just toss in lwjgl drivers and have the Java 1.5 OpenGL pipeline work, but as far as I’ve read up on it, that feature doesn’t seem to work on much of ANYTHING.

Cas, you tried to explain something abstract… but you got a little too abstract for me. I lost you there and I’m not sure what your idea was :slight_smile: With that in mind… your “it’s probably not worth it” comment seems to make sense :slight_smile:

Just curoius, but would the changes/additions in Java 1.5 make a difference without learning LWJGL?

Well they haven’t for me. My video card claims to support OpenGL of a more recent version than is required, but the Java requirements to enable the OpenGL pipeline for Java2D actually are pretty complicated and my card, a 64 meg 3D graphics card (I think that’s good) can’t handle it. Which means… many cards won’t work with it even if they support LWJGL or JOGL.