Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
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  
  Alpha shapes are slow.  (Read 1892 times)
0 Members and 1 Guest are viewing this topic.
Offline thedracle

Senior Newbie




Java games rock!


« Posted 2003-01-28 14:23:14 »

Drawing semi-transparent shapes with an alpha comonent is SLOW SLOW SLOW.

I really can't understand where the bottle-neck is now. I'm drawing semi-transparent shapes (About 20 every frame), and my frame-rate is suffering horribly due to it. I'm getting around 9 FPS, and without the shapes being drawn at least 29-32 FPS (Which is what I'm shooting for). Any suggestions?

-Jason Thomas.
Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #1 - Posted 2003-01-28 15:00:29 »

Of course they are slow!! Transparency is *extremely* hard to accomplish if not supported by hardware.

So if you really need it, head for using a 3D accelerator.

Ahm, or try doing it yourself! Would need to specialized and easy to handle color format (indexed, or 24bit RGB?), specialize on certain transparency levels and then write pixel-setting routines. This will enligthen you how difficult it can be doing it fast.

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline Abuse

JGO Coder


Medals: 11


falling into the abyss of reality


« Reply #2 - Posted 2003-01-28 17:08:53 »

also, if your drawing onto a VolatileImage (that includes BufferStrategy rendering) performance will absolutely die.

if you *have* to use an AlphaChannel (or AlphaCompositing), make sure all your images are in main memory. (not vram)

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline thedracle

Senior Newbie




Java games rock!


« Reply #3 - Posted 2003-01-28 17:57:20 »

Ugh.. So it doesn't just use a BITMASK in the background? I mean.. You'd think it would just draw every other pixel in it's routine, rather than actually drawing transparent pixels. Also, is using a BufferedImage risky? I know as a fact often these Images will be implemented as an "Automatic Image", meaning sometimes it may be using a VolatileImage in the background. Perhaps I should just use a regular image.

-Jason Thomas.
Offline Captain-Goatse

Junior Member




I suck at teh 2D. XBOX IS BIG LOL!111


« Reply #4 - Posted 2003-01-28 19:00:45 »

I found out that the best way of doing this was making gifs manually transparent in the file.

Just draw every other pixel transparent, but this only work on reasonably high resolutions AND the hardware acceleration(?) disappears if you turn it into bufferedImage, or at least did for me in certain areas. Yes it is frustrating, but at least you have an option.
Offline Abuse

JGO Coder


Medals: 11


falling into the abyss of reality


« Reply #5 - Posted 2003-01-28 22:15:32 »

IMHO automatic images are the best solution
( graphicsConfiguration.createImage(width,height,[Transparency.OPAQUE|Transparency.BITMASK]) )

here are my reasons...

1) automatic images are *almost* as fast as VolatileImages (ive benchmarked the 2, the difference realy is negligable)

2) automatic images support bitmask transparency (impossible with VolatileImage in the current 1.4.1_01 api)

3) automatic images handle the loss of their vram surface automatically, hence, less code.

4) if you draw an automatic image and perform a software operation (such as AlphaCompositing) the version of the automatic image in main memory is used.
If you do the same with a VolatileImage, the performane hit is very dramatic (the image has to fetched from vram, the operation performed, and the image copied back to vram)

i've got a little app. that demonstrates these issues.

http://www.pkl.net/~rsc/Balls.jar

its got all sorts of options, 1 of the most interesting, is this :-

set the imageType to VolatileImage
the buffering mechanism to BufferStrategy
and turn on AlphaCompositing

then, compare it to the speed of this :-

imageType automatic image (masked or unmasked)
buffer strategy to Normal
AlphaCompositing on as well

IMHO, VolatileImage should be ditched from the API, and hardware acceleration should be done behind the scenes.
In its current state VolatileImage is useless, and until all pixel operations have hardware support enabled, it always will be.

abu,

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
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.

ctomni231 (34 views)
2014-07-18 06:55:21

Zero Volt (30 views)
2014-07-17 23:47:54

danieldean (25 views)
2014-07-17 23:41:23

MustardPeter (27 views)
2014-07-16 23:30:00

Cero (42 views)
2014-07-16 00:42:17

Riven (44 views)
2014-07-14 18:02:53

OpenGLShaders (32 views)
2014-07-14 16:23:47

Riven (33 views)
2014-07-14 11:51:35

quew8 (30 views)
2014-07-13 13:57:52

SHC (66 views)
2014-07-12 17:50:04
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!