poor performance with translucent images in java2D

hi,

when i load an image with the transparency flag set to Transparency.BITMASK or Transparency.OPAQUE i have no problems drawing these images at about 50 fps.
but when i set the flag to Transparency.TRANSLUCENT (because the explosion sprites look so much better this way 8)) my framerate decreases and the game runs really slow.

my question is: is this a known limitation to Java2D or did i miss something?

Yes, there are issues.

Read the last post by Campbell:
http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=2D;action=display;num=1108967567

ok, so we currently have no solution to these problems?

i assume i have to switch to JOGL or LWJGL to achieve better graphics performance, right?

[quote]Yes, there are issues.

Read the last post by Campbell:
http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=2D;action=display;num=1108967567
[/quote]
No, my last post was specifically discussing issues with the OGL pipeline. I’m assuming MOD’s question was regarding TRANSLUCENT image performance on Windows. If that’s the case, please read about the “translaccel” flag, which allows us to accelerate translucent images in hardware:
http://java.sun.com/j2se/1.5.0/docs/guide/2d/flags.html#translaccel

In Mustang, all images (including translucent ones) should be accelerated in hardware by default via D3D, so this flag should be unnecessary in the future. Dmitri will have more details on that work soon.

Chris

exactly. i just wanted to know if there’s a way to accelerate translucent images.

i started my app from the command line with these two flags

-Dsun.java2d.translaccel=true
-Dsun.java2d.ddforcevram=true

and it works better now. thx a lot!

now i only have to figure out how to set these flags in my jnlp file…

hmmm …

this seems not to work:


<resources>
    <j2se href="http://java.sun.com/products/autodl/j2se" version="1.4+"/>
    <jar href="ec.jar"/>
    <jar href="images.jar"/>
    <jar href="sounds.jar"/>
    <jar href="gagetimer.jar"/>
    <property name="sun.java2d.translaccel" value="true"/> 
    <property name="sun.java2d.ddforcevram" value="true"/> 
</resources>

???

You could try using the OpenGL pipeline as discussed in the other thread if your images use BufferedImage rather than Image. Translucent performance was pretty good in my microbenchmark.

but then you have to wonder about who will be able to play the game. I can use LWJGL fine on my machine, but I can’t use the OpenGL pipeline in Java2D. From what I understand less than 50% of people with Java 5 can actually use it in its current state.

Yes the OpenGL pipeline is not perfect yet. Experimental use only for the moment I suspect…