anti-aliased graphics.

Hi,

I just started with programming games in Java (been playing with Flash and ActionScript2.0 quite a bit, but stumble upon limitations which Java can easily overcome), and got a bit curious about graphics. Skimming my way through a book by David Brackeen (what do you think about it btw, if you know it?).
In his book he is using the AWT to draw graphics on the screen, but unfortunately translucent graphics are not hardware accelerated. So to keep things fast and stable, he suggests to keep the edges of your graphics jagged and take it as it is.

But I think there must be a way to have the graphics anti-aliased (and hardware accelerated). Do I have to use OpenGL bindings to do this? And is it better to use an API like jogl or LWJGL instead of the AWT or should I learn the game programming first and the graphical details later?

Thanx.

try using
System.setProperty(“sun.java2d.translaccel”,“true”);
when you start up your game. I don’t know exactly what it does, or when all it works, but aparantly it’s supposed to hardware accelerate translucent graphics :slight_smile:
I also try another little technique when I can…

If I have an anti-aliased image, like a planet, over a background that tiles, or is in some way relatively unchanging, I make a new BufferedImage that’s opaque and draw the tiled background on it FIRST, then draw on the planet. Since the stuff under it never changes, you never know there’s a difference.

Uhm… for clearing things up a bit. For sprites and the like you can either use opaque, bitmasked or translucent images. Opaque images have no transparency at all. Bitmasked images have pixels which are either fully opaque or fully transparent. Translucent images have a seperate alpha channel… so you have 256 different “shades” of transparency there.

Ok. That’s the one part.

And antialiasing is that stuff used for lines/text etc. It’s also some kind of fullalpha, but all those pixels are generated at runtime (and setting that transaccel flag doesn’t help at all right now). Antialiasing is really slow if you do it on a frame by frame basis.

Well, if you want to use fullalpha you can use that flag, but you won’t get consistent performance across different platforms. Using LWJGL (or JOGL) helps. [If you want lots of blending or rotation opengl is the way to go]

However, most games can look perfectly fine with simple bitmasked images. It really depends on the style you want to achieve and the tricks you’re able to use. You can for example make a perfect looking breakout game without using full alpha. The trick is simply using a single color background and have the ball image copied over into a small image with the same color as the background (at the beginning).

So, use simple opaque/bitmasked images at the beginning. Learn the concepts etc and move on.

My first game for example (TC 256 color mode) didn’t even had any images at all. Needless to say that it really sucked (as everyone’s first game heh ;)).

Just to answer one of ur small questions. I have David Brackeens book and it COOL. I’m on the part where u use the simple screen manager. I haven’t even attempted the 3D stuff yet.

:slight_smile:

Hauk