I’m trying to figure out the best way to incorporate a 2D HUD into my OpenGL application.
I’ve considered using a JPanel and drawing my 2D the Swing way, but I found some drawbacks
-The current JPanel is really slow. While one of my demos flies at 900 FPS with a GLCanvas, a JPanel sinks it to 50 FPS (and even then, I suspect it’s lower becasue the animation is choppy)
-While JPanel is much faster in Mustang, Mustang’s still more than eight months from release.
- Even in Mustang, the Vertex Buffer Object is really slow. The demo also has problems, with windows sometimes vanishing or terminating abruptly.
My next best idea so far is to create a large texture on the GPU, draw my HUD into a BufferedImage and use glTexSubimage2D() to upload it whenever my HUD changes.
Or would it be best to keep my image on the client side and use glDrawPixels() to draw my image each pass?
I will potentially have a 1600x1200 screen size, and would appreciate hearing what worked for other folks with HUD creation.