Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (480)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (546)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / Java 2D / Re: Transparency Problems on: 2011-06-11 08:02:15
Hey, first of all thanks for your answers!

I added:
1  
-Dsun.java2d.opengl=true

but nothing changed.

Quote
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


Quote
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

Greetings
FireDragon
2  Java Game APIs & Engines / Java 2D / Transparency Problems on: 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

1  
img = ImageIO.read(url);


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

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
private static BufferedImage createCompatibleImage(BufferedImage img) {

    // Get default graphics device
   GraphicsDeviceService graphicsDevice = ServiceProvider
            .getService(GraphicsDeviceService.class);
    GraphicsConfiguration config = graphicsDevice
            .getGraphicsConfiguration();

    // 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);
    graphics.dispose();

    // 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
FireDragon

p.s. nice forum registration process Smiley
Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

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

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

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

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

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

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

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

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

Norakomi (35 views)
2014-08-06 19:49:38

BurntPizza (64 views)
2014-08-03 02:57:17
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!