Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (482)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (550)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  anti-aliased graphics.  (Read 981 times)
0 Members and 1 Guest are viewing this topic.
Offline jorrit5477

Innocent Bystander




Java games rock!


« Posted 2004-11-08 17:24:05 »

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.
Offline Malohkan

Senior Member




while (true) System.out.println("WOO!!!!");


« Reply #1 - Posted 2004-11-08 21:29:15 »

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 Smiley
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.  

Admin and Game Developer at
GameLizard.com
Play Rimscape!    |    Play Conquer!
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #2 - Posted 2004-11-09 04:53:14 »

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 Wink).

弾幕 ☆ @mahonnaiseblog
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Hauk

Junior Member




Guitar, Norse Mythology, java and women=life


« Reply #3 - Posted 2004-11-21 15:08:41 »

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.

Smiley

Hauk

I want to become a hermit and live in the harsh wastelands of Norway. I want to have a cloak made of bearskin and hunt the demons of the night.

I was born for a reason and am not about to lie down and die like the rest of you. Anybody with me?
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CopyableCougar4 (14 views)
2014-08-22 19:31:30

atombrot (28 views)
2014-08-19 09:29:53

Tekkerue (25 views)
2014-08-16 06:45:27

Tekkerue (23 views)
2014-08-16 06:22:17

Tekkerue (15 views)
2014-08-16 06:20:21

Tekkerue (22 views)
2014-08-16 06:12:11

Rayexar (61 views)
2014-08-11 02:49:23

BurntPizza (39 views)
2014-08-09 21:09:32

BurntPizza (31 views)
2014-08-08 02:01:56

Norakomi (37 views)
2014-08-06 19:49:38
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!