Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (564)
Games in Android Showcase (151)
games submitted by our members
Games in WIP (605)
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  
  Transparency Problems  (Read 2740 times)
0 Members and 1 Guest are viewing this topic.
Offline FireDragon

Junior Newbie

« Posted 2011-06-10 18:54:09 »

Hey everyone

we are currently developing a game in Java using the Java2D API and are experiencing some strange performance issues when running it in an Linux environment.
Our frame rate drops from an average of 62fps on Windows and Mac systems to about 10fps on Linux. After some hours of debugging and testing various JVM flags it seems to be that BufferedImages using a bitmask are not being accelerated under Linux.

We tested our game on different pc´s, with different hardware under Linux, and the effect stays the same. It´s an project for an university class, which has to run under Linux perfectly  Sad

We have a some sprites on your screen, which have a lot of transparent pixels. After removing sprites and other transparent images the framerate returns to constant 60fps.
Currently we are loading our images via

img =;

and are then creating a device compatible BufferedImage using the following method:

private static BufferedImage createCompatibleImage(BufferedImage img) {

    // Get default graphics device
    GraphicsDeviceService graphicsDevice = ServiceProvider
    GraphicsConfiguration config = graphicsDevice

    // Get desired transparency mode
    int transparency = img.getColorModel().hasAlpha() ? Transparency.BITMASK
            : Transparency.OPAQUE;

    // Create device compatible buffered image
    BufferedImage ret = config.createCompatibleImage(img.getWidth(),
            img.getHeight(), transparency);

    // Draw old image onto new compatible image
    Graphics2D graphics = ret.createGraphics();
    graphics.drawImage(img, 0, 0, null);

    // Return compatible image
    return ret;

We are already using the "pmoffscreen" property.

I´ve seen that many topics about transparency problems already exists in this forum, but I didn´t really find an answer to our problem.

Has anybody an idea, what we can do, to ensure a good framerate but still using transparent images?

Thanks for reading!
I would really appreciate help Smiley
Best regards

p.s. nice forum registration process Smiley
Offline cylab

JGO Ninja

Medals: 78

« Reply #1 - Posted 2011-06-10 22:14:50 »

Maybe activating the opengl pipeline may help:

Mathias - I Know What [you] Did Last Summer!
Offline Abuse

JGO Knight

Medals: 17

falling into the abyss of reality

« Reply #2 - Posted 2011-06-10 23:03:54 »

What's the performance like when you:

a) use Transparency.TRANSLUCENT (instead of BITMASK)
b) use the BufferedImage returned by ImageIO directly (instead of going through the legacy process of making it compatible)

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline philfrei
« Reply #3 - Posted 2011-06-11 00:23:17 »

Might be interesting comparing cpu snapshots on the different OS, using jvisualvm.exe.

"We all secretly believe we are right about everything and, by extension, we are all wrong." W. Storr, The Unpersuadables
Offline FireDragon

Junior Newbie

« Reply #4 - Posted 2011-06-11 08:02:15 »

Hey, first of all thanks for your answers!

I added:

but nothing changed.

What's the performance like when you:

a) use Transparency.TRANSLUCENT (instead of BITMASK)
b) use the BufferedImage returned by ImageIO directly (instead of going through the legacy process of making it compatible)

When i´m unsing Transparency.TRANSCLUENT the framerate even dropps lower.. The quality of the images increases but we only have now about 7 fps.

When i return the ImageIO directly, i ´ve only 2 fps! Sad

Might be interesting comparing cpu snapshots on the different OS, using jvisualvm.exe.
Here is a screenshot of a windows pc:

i´ll add a linux screen later

Offline pitbuller
« Reply #5 - Posted 2011-06-11 10:17:33 »

I did have same problems with my java2d game. I tried everything but after a month of head banging I did get frustrated and just give up. Everything worked well with most machines but some older machines or computers with obscure graphic crad everything was just slow. Transparency also bugged somehow and colors of clouds was like at acid trip. Maybe you should test what fps you get with my game under linux enviroment.
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

theagentd (9 views)
2015-03-27 23:08:20

wxwsk8er (52 views)
2015-03-20 15:39:46

Fairy Tailz (45 views)
2015-03-15 21:52:20

Olo (28 views)
2015-03-13 17:51:59

Olo (30 views)
2015-03-13 17:50:51

Olo (35 views)
2015-03-13 17:50:16

Olo (41 views)
2015-03-13 17:47:07

ClaasJG (40 views)
2015-03-10 11:36:42

ClaasJG (39 views)
2015-03-10 11:33:01

Pippogeek (47 views)
2015-03-05 14:36:23
How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27 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‑
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!