Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Java2D be as fast as LWJGL and JOGL?

I've heard that Java2D uses OpenGL behind the scenes to do it's rendering, and I've wondered if it's worth it to use JOGL and all it's native libraries for my program which is simply a 2D side scroller. I've heard that there are certain techniques you have to use and scenarios you need to avoid to make sure hardware acceleration is being used but I don't know what they are(well, I know a few, but I've yet to find a comprehensive list of them.).

like image 853
HahaHortness Avatar asked Dec 12 '22 14:12

HahaHortness


1 Answers

As someone who co-developed a 2D casual game in Java using LWJGL, I recommend against using LWJGL or JOGL if you're going to be making a casual game.

Pros:

  • Simplified engine writing: OpenGL has a high fill-rate, meaning you can redraw the screen every frame.
  • Possibility for cool 3D effects.

Cons:

  • All users needs to have a 3D card.
  • All users need to have an OpenGL driver installed. Windows 7 does not come with any OpenGL drivers installed (look up "pixel format not accelerated" on Google to see the kind of fun that results in).
  • 3D cards eat battery, especially on old laptops. People often play casual games on laptops, so this can be a problem.
  • Applets need extra permissions to be able to use the 3D card. This results in an scary permission dialog a user has to click through to play your game, unless you're willing to buy a $500 certificate.

My recommendation would be to use a Java2D rendering and animation framework like PulpCore to develop your game. I wish we had.

like image 127
cdmckay Avatar answered Dec 28 '22 10:12

cdmckay