I'm currently painting my HUD with Java 2D, as was also described in the original HUD tutorial in the wiki. The reason why I'm using this obviously slow method is that I need to paint many texts, boxes etc. that are updated every frame. However, the pure Java 2D part of repainting the BufferedImage that is used as HUD takes about 40 - 60 milliseconds, which takes the entire framerate down quite a lot.
Some things that I might try:
- Only repaint the HUD every N frames.
- Do all the Java 2D stuff in a background thread, and grab the latest image from the rendering thread.
- Break the HUD into multiple, smaller images.
Would these be good choices to get around this, or would I be better off dumping Java 2D entirely and just picking some other GUI library which uses OpenGL?