Should i learn lwjgl instead of java2D

i have now been doing java2D for over 3-4 years! should i start with lwjgl?

what can lwjgl give me that i cant do in java2D?
does lwjgl render better?
what does lwjgl have?

i’am good with java2D, think i should upgrade?

Libgdx

tell me what it can give me that java2D does not have or can do? or is easyier to do in libgdx!

LWJGL will give you OpenGL knowledge. Libgdx is virtually the same but has a whole ton of other stuff added on to it.

LWJGL gives you basically high performance graphics in the way the graphics card understands, at the cost of being at a lower level of abstraction to Java2D. Java2D has lots of very very nice stuff for rasterising complex primitives and so on; OpenGL lets you basically render triangles, points and lines and texture them.

OpenGL will probably be more useful to you in the long run than Java2D one way or another.

LWJGL also gives you a sound API that’s actually good (OpenAL) vs. JavaSound which is not.
And some fairly simple display management stuff which is much easier to use than AWT again at the cost of being rather less fancy.
And some great mouse/keyboard input APIs.

Cas :slight_smile:

so libgdx or lwjgl =/ what one do you recommend for 2d platformers

If I were just starting out making games I’d not recommend Java at all :slight_smile: But if you must, I’d go for libgdx.

Cas :slight_smile:

ik how to make games i know basic collision prevention,map loading, creating gameStates, loading spriteSheets and stuff like that!

i just want them to be smoother and implements lights and stuff like that!

Libgdx can be frustrating to initially setup, but don’t be discouraged by that because it makes all the other things you want to do work much better and easier

I remember being in this same spot a year ago. So Java2D is usually used for testing because it’s too slow for a real game. LWJGL is a Java conversion of OpenGL. OpenGL uses the computer’s graphics (in depth stuff. just Google it) and such to render games. Libraries like libGdx and Mercury make it easy to use these commands. I recommend you learn libGdx or mercury, make a few games, then give LWJGL a try. If you try now, it still may be complicated. But then again you may know a lot more than I did with your 3-4 years

thanks!

It’s neither a Java conversion nor a Java port, it is a set of Java bindings for several low level APIs (OpenGL, OpenAL and OpenCL).

I prefer LWJGL. Libgdx is great with all of its supplemental classes though. Like spritebatch, texture, textureatlas, etc…

However, if you go through with the LWJGL path you will feel more accomplished since you will have to learn and create your own rendering strategy and such.

Okay, there seems to be a various declarations here that are misleading, I’d like clear them up. First of all, OpenGL is a software interface for Graphics cards (GPUs), and is implemented in the driver level and hence it can’t be ported. The same is with the case of OpenAL and OpenCL. These are C APIs and cannot be directly called from Java or other JVM languages.

This is where LWJGL comes into the scene, it generates bindings from Java to those C APIs using JNI, and provides you a way of using those APIs from Java. That is why it is called Light Weight, all it does is mostly in the low level. This is what LWJGL is.

Now, for the matter of which one to use, it depends on your background and what you are aiming to do. LWJGL, despite of having Game Library in it’s name, doesn’t provide the utilities for making games, it only wraps up the toolkits that you need for graphics, sounds etc., and leaves you to do whatever you want. But to do so in OpenGL, you must learn how to render, textures, how they work and so… A lot of work if you just want to make a game.

LibGDX considers it as another framework that uses LWJGL as one of its backends on Desktop. It provides you with some utilities that handles some common game related tasks like managing the game loop, providing UI library (scene2d) and other things that helps you in your game. But even here, you are required to write your own logic, your AI, collision detection and other things.

A GameEngine, in my opinion, gives you more high level approach in making your game. Suppose, if you want to make a breakout game (assume), you will just say it that you want to bounce off when you hit a brick, and it will take care of the collision detection, and it will bounce the ball for you. It will properly calculate the direction you are moving, calculates the distance between the ball and the brick, and properly adjusts the velocities so that it will bounce. This is what I aim to make with SilenceEngine, hence I call it a GameEngine and not a library.

As a side-note, it is already possible to do that bouncing in SilenceEngine. For information on how to do that, see the [icode]GridSceneColliderTest[/icode]. All you have to do is just call the bounce method in the Entity2D class and pass it another Entity2D to bounce upon. Easy right??

I think you just nailed what the difference between a game engine and a game library is. Awesome post.

As for which I think you should start off with, let me just sum it up quickly.

LWJGL/JOGL: low-level and a pain in the ass to start using if you’re a newbie.
LibGDX/Slick2D/Mercury: easy to pick up and are designed to simplify all of the OpenGL/LWJGL stuff for you, and as well give you extra utilities for different things like spritesheets, logging, etc.

Unless you really want to dive into the code and learn how everything works, stick to one of the other libraries.
Learning LWJGL is a complete waste of time if you aren’t going to be doing anything super fancy with it IMO.

If you still haven’t decided, take a little peek at all of them and decide which one you think is the easiest to use.
It’s all a matter of personal preference in the end.

  • Jev

I would rather compare it to JogAmp as it is a set of Java bindings for several low level APIs (OpenGL/OpenGL ES, OpenAL, OpenCL) too.

It’s really difficult to tell you what to choose, it depends on how deep you want to go, what you want to learn…

In my humble opinion, middle level libraries and high level ones allow you to work faster if you really understand them. Some developers prefer using them and not to look underneath which is viable as long as it works very well, it is well documented and it works as expected. However, I agree a bit with what KudoDEV wrote, you learn a lot and you become much more autonomous when you know the concepts and how the things work internally. If you don’t mind relying on some developers experienced with low level APIs, you can use higher level solutions. Otherwise, be prepared to learn lots of things, be patient.

Keep in mind that if everybody here writes some engines and some libraries, nobody will create games :frowning: (okay, some of them do both)

My two cents is to take your time and think about what you will really need, and then use whatever framework/binding/lib/whatever has what you will really work with. No need getting LibGDX if you only want to use OpenGL, for example. One thing to really keep in mind is that when you start learning the API for one tool, it may be harder to switch to another tool with a totally different API.