Newbie question: 2-D Games with LWJGL

Started by gmaletic, October 21, 2005, 05:50:07

Previous topic - Next topic

gmaletic

Please excuse the newbie question, but here goes:

I'm a very experienced Java developer looking to write a 2-D sprite-based game. In a cursory look-through of the LWJGL documentation, it appears to be very 3-D based. As I don't have any OpenGL experience, maybe you can answer for me: are 2-D games under LWJGL (such as Ultratron over at http://puppygames.net) implemented using the 3-D APIs? Or are there 2-D sprite-based APIs that should be used instead?

Thanks very much,

Greg

Matzon

it's implemented using a 3D api. Specifically LWJGL :)
You can easily do 2D in an 3D api, since you just zero the z coord everytime.
The great thing about using OpenGL for 2D games is that you can make it 2.5D and let particles travel in and out - best seen in Alien Flux. Also, using 3D hardware is insanely much faster than normal 2D blitting.

oNyx

There are some bits, which make 2d stuff easier. Like there is glVertex2i/glVertex2f, which take 2d coords. And there is also orthographic projection, which is used in 3d games for things like menus or hud stuff.

Once you wrapped it up its very easy to use (like java2d if you will).

Take a look at the space invaders example (lwjgl-source-0.98/src/java/org/lwjgl/examples/spaceinvaders).

princec

Or the source code to Ultratron which is lurking around somewhere.

Cas :)

gmaletic

Thanks, everybody, for your help. Can I assume that buying a book on OpenGL might be a good investment? And if so, can anyone recommend a good one?

Thanks very much,

Greg

CaseyB

You can find the OpenGL RedBook on line, but a lot of people prefer to have a hard copy.  Other than that almost all of the books that you'll find will be in C++ so if you are unfamiliar with that you may have a few problems, though the OpenGL code should be almost identical.

gmaletic

Quote from: "princec"Or the source code to Ultratron which is lurking around somewhere.

Cas :)

Is the source code to Ultratron available? I ask because I know it's a commercial product (I bought it yesterday). If it is available, however, I'd love to take a look at it...the game looks and sounds great.

--Greg


gmaletic