newbie: Can LWJGL be used to accel. my 2D games?

-Can LWJGL be used to accelerate my 2D games?
-Should I wait for JDK1.5 (or JSR 134) if I’m looking for 2D graphics more closely geared for games? (I’m using BufferStrategy and such now).

If I understand correctly, are LWJGL games distributed as native programs, not requiring a JRE install?

EDIT: Made changes - the “I’m using BufferStrategy” part is now a statement, not a question.

-yes
-yes
-who knows?
-that’s not a question, I can answer… because I don’t know if you use BufferStrategy or not :>
-no. They are usual class/jar files, wich requires a native library. If you want to make a native java programm you have to use something like Jet (like Cas did).

So, are you saying:

  1. LWJGL software does require a JRE install (unless compiling to native code)?
  2. By packaging the .JAR file with different native libraries (depending on the OS I’m targeting) I can easily make a cross-platform game?

Did that clarify?

yes
yes (depending on ones definition of “cross-platform”, win32, linux and soon™ mac os x should work™ :wink:

unless I’m mistaken ;D

Excellent! Now, can anyone point me the best tutorial you know of for the 2D and OpenAL parts of LWJGL (the more thorough the better).

There are no ‘2D parts’ of LWJGL. On the graphics front, it provides an interface to OpenGL. How you make use of it is entirely up to you. I don’t know of any ‘2D with OpenGL’ tutorials off of the top of my head (other than a short tutorial I saw once at http://www.gamedev.net/). I suggest you 1) check out http://www.opengl.org/ and see what resources they have and 2) use Google to search for ‘OpenGL 2D tutorials’, or something along those lines.

a bunch of tutorials:
http://chman-area.tuxfamily.org/

general opengl tutorials:
http://nehe.gamedev.net/
(GL_LINES gets GL.LINES etc ;))

stuff I need to say:
-your game will require an openGL compatible graphic-card (everyone who plays a game once in a while does have one)

-your games can’t run as an applett

-doing 2d is basically putting textures (your sprites) on quads (rectangular polygons)… btw you should check the document by nvidia posted by Orangy Tang in the “how to… scanlines” thread. It’s about the way the rasterizer works and how you can hit single pixels exactly. You don’t need to understand it completly right now but it might be helpfull in the not to distant future :wink:

Well, thank you, everyone, for a freash start. It’s easy to see why LWJGL is so popular, if everyone is both this helpful, and this exicted about using the technology.

I will undoubtedly have a lot more questions as time goes on, but for now I say thank you, and I’ll be off to the tutorials!

I promise to write a big long series of articles about writing a game in Java and LWJGL soon. Just wait for A.F to get out of the way and then I’ll begin.

The code examples I use will generally be lifted straight out of A.F. as well so you can be sure it’s the right way to do it :wink: Or at least, a right way.

Cas :slight_smile:

There can be a problem when switching from java2d to opengl, your game may run faster on medern machines, but much slower on older machines, as these have sometimes slow 3d-chips (and bad opengl drivers), but fast 2d-units.

'srite. LWJGL is generally for computers less than 3 years old which tend to come with proper 3D. In the not-too-distant future this will of course be most computers, but right now, it’s only about half of them (and a lot less for laptops).

Cas :slight_smile:

“I promise to write a big long series of articles about writing a game in Java and LWJGL soon. Just wait for A.F to get out of the way and then I’ll begin.”

Now that’s what I like to read. Just cant wait to see how everyone here is posting “Test my A.F2K/A.FSuper” and similar clones. It’s gonna like a new worm game genre :slight_smile:

You plan to publish a hardcover book about “LWJGL for Dummies”? (ofc a namechange finalized first).

cya

[quote]'srite. LWJGL is generally for computers less than 3 years old which tend to come with proper 3D. In the not-too-distant future this will of course be most computers, but right now, it’s only about half of them (and a lot less for laptops).
[/quote]
Heh. My comp is over 3 years old… even my last OS-install is :>

25.12.1999 and it’s still running :slight_smile:

Well these 3 years seems to be a good rule of thumb right now.

Strictly off topic, but I wondered if anyone recognized the quote that’s under my picture (it’s from a PC game). I placed it there to see if I could get a reaction from anyone.

So? Any takers?

Sanitarium, if i remember correctly. Twisted, freaky game :o The product of a very disturbed mind.

[quote]The product of a very disturbed mind.
[/quote]
IIRC there were even deaf children in that game :o

I’ve got another total newbie question. I downloaded LWJGL 0.6, but I can’t seem to run any of the demos. Can someone explain the directory structure to me (where a .class file should be placed in relation to the LWJGL .jar and .dll files)?

A more specific error message would be nice, but the general way to run the demos is to do

java -Djava.library.path= -cp lwjgl.jar;lwjgl_test.jar;examples.jar

(assuming windoze)

And you can omit the lwjgl_test.jar and examples.jar if you only need lwjgl for your own app.

  • elias

Heres what I do for fun:

I installed lwjgl to it’s own directory (c:\lwjgl-0.6) and just told eclipse lwjgl.jar was a part of my project (classpath), then in the run menu, under arguments->VM arguments i have: -Djava.library.path=c:\lwjgl-0.6\ so it looks for the dll there too.

If your not using eclipse you should give that a go too. www.eclipse.org

Thank you for the quick replies.

I will look into JXInput.

I’ve used Eclipse - I’m perfectly fine with my text editor and syntax highlighting. I’ve used IDE’s in the past, and I always go back to my text editor, but thanks for the info.

Thank you again, everyone…I’ve never started a thread that had so many useful posts, and helpful / knowledgable people.