I'm looking to create a nice-looking display for a Game of Life application I wrote... currently it looks like this:
but I want it to look like this:
Any suggestions of how to do this? Especially would like nice lighting effects, and preferably with a 2D API since I've never done anything in 3D. Is the built-in Java 2D at all useable? I've looked at PulpCore briefly, but I think that's mainly for applets rather than desktop apps.
Java 2D is certainly useable, it is hardware-accelerated, it's very well suited to do nice, smooth animations.
It can do double-buffering (or even use more than 2 buffers) for that. That means that you have two buffers to draw on in your application: one that is shown on screen, the other one is what your program is actually drawing on. When you're done drawing the next frame of the animation, you swap the two buffers (and then start drawing the next frame on the one that's now hidden).
There are several libraries for 3D graphics. There is for example jMonkeyEngine which is an impressive 3D graphics engine, with which you can relatively easy make great looking 3D graphics. Another one is LWJGL, which also provides you with OpenGL 3D graphics, OpenAL 3D sound and other things.
The target example has a black background and white circles painted on it. It also seems to have partially transparent "glows" that can overlap.
You example seems to have a white background and blue squares painted on it.
The biggest hurdle seems to me to be figuring out how to make glowing effects. You can probably figure out for yourself how to do the black background and paint circles instead of squares. You should look into how to use colors that have "alpha" values, such as RGBA format where the "alpha" is the degree of transparency. Also, there are possibilities such as using GradientPaint or RadialGradientPaint (and the gradients can apply to alpha as well as R, G, or B).
Here's the link for Color. Be sure and check out the info there on transparency (alpha settings) and try applying it to Paint objects.
So, paint the background black, pop on a larger circle with the desired "glow" transparent color, then put a smaller white circle over that. That might get you 80% of the way to what you want.
Applying full Gaussian blurs in real time is computationally demanding (and inefficient), so I'll look at pre-computing the LED images. If I only want to display 1 size and a restricted colour palette I could just render those images in a paint package, but the problem becomes less interesting. I'd like to be able to scale to any resolution without a high performance penalty, and also have freedom to easily change colours.
Also I'll probably implement a mirror effect for the surface the panel is sitting on, which shouldn't be too hard.
Here is a demo in PulpCore (click the moons for reflection and other effects) - surprising there is such a good API for applets but nothing similar AFAIK for normal Swing apps (maybe JavaFX was supposed to fill this niche?). Maybe I should program this as an applet, but I don't suppose those will be hardware accelerated?