Hi StackOverflow people!

I would like to know how easy it could be to move from XNA to using LWJGL.

Just wanted to throw this out there because of the rumors that MS is shutting down XNA and having an interest in checking out gamedeveloping in Java.

Thanks in advance for your interest.

  • \$\begingroup\$ If you like XNA try MonoGame. I've seen it recommended by microsoft employees in their personal blogs and use it myself with no issues. Also personally after getting used to C#, Java is lacking in features and generally extremely simplistic to the point of being a fault. \$\endgroup\$ Commented Feb 11, 2013 at 15:20
  • 1
    \$\begingroup\$ How difficult it will be to switch depends on your skill, the language features you used and the size of your project. There's no way to give a correct answer for this. Please see the FAQ about what types of questions to ask here. \$\endgroup\$
    – House
    Commented Feb 11, 2013 at 15:23
  • \$\begingroup\$ When you are talking about porting an existing project from XNA to LWJGL: When you started a project building on a specific technology, it's usually not worth the effort to change the technology in the middle of it. \$\endgroup\$
    – Philipp
    Commented Feb 11, 2013 at 16:31
  • \$\begingroup\$ Also, you do not "switch" from one programming language or library to another. You learn another tool, and then you decide which tool is the best one for each specific project you undertake based on your experience with each tool. \$\endgroup\$
    – Philipp
    Commented Feb 11, 2013 at 16:33

2 Answers 2


Well, how easy it is will vary from person to person. I can speak from experience, as I made the same switch (well, kind of) a couple of months ago (due to the same rumors).

I decided to learn how to use the OpenTK library (definitely worth checking out if love C# as much as I do), but that kind of has the same learning curve as LWJGL (I have created some applications using that as well, but I always struggle with Java).

Now first you need to know a couple of differences between the two frameworks:

  • XNA uses Direct3D, LWJGL uses OpenGL
  • XNA is a "proper" framework, LWJGL is a wrapper

Now I have not chosen the last term to debase LWJGL, I just couldn't find a better term for it.

The first thing doesn't mean a lot, since XNA is an abstraction layer, and you don't have to use Direct3D directly yourself, XNA will take care of that. With LWJGL, however, you will have to have some knowledge about OpenGL, since you will be directly interacting with it.

This will mean that you will have to implement more things for yourself, so creating an abstraction layer yourself is probably a good idea (LWJGL doesn't have the SpriteBatch class, for example).

Apart from that, it won't be that difficult. Interacting with graphical hardware works in a similar fashion for all frameworks, so if you already know the basics of vertex buffers and shaders, you'll probably be able to master LWJGL in a couple of months of off and on coding.

  • \$\begingroup\$ +1 agreed, for a better comparison LibGDX, Slick2D are more of a framework on top of LWJGL and would be more of a comparison to XNA \$\endgroup\$ Commented Feb 11, 2013 at 21:17

Java lacks some features(useful for gamedev) that C# has:

  1. Operator overloading: In XNA, you can treat vectors like numbers: Position += Velocity. In Java, you have to use methods: Velocity.add(Position), or store vectors as two floats.

  2. Value types: In XNA, you can have Vertex struct. Array of these can be send directly to OpenGL. In Java, you have to use array of primitives. Also, value types are useful for optimization: they don't need Garbage Collector, need less memory, and may be sometimes faster because of the CPU cache.


Not the answer you're looking for? Browse other questions tagged .