Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (527)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (593)
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  
  Active rendering under Mac OS X  (Read 1235 times)
0 Members and 1 Guest are viewing this topic.
Offline zeroone
« Posted 2011-02-13 18:24:11 »

Did anyone check if the poor performance of active rendering under Mac OS X is a consequence of not creating screen compatible images?  Examples of screen compatible images appear below.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gs = ge.getDefaultScreenDevice();
GraphicsConfiguration gc = gs.getDefaultConfiguration();

// Create an image that does not support transparency
bimage = gc.createCompatibleImage(width, height, Transparency.OPAQUE);

// Create an image that supports transparent pixels
bimage = gc.createCompatibleImage(width, height, Transparency.BITMASK);

// Create an image that supports arbitrary levels of transparency
bimage = gc.createCompatibleImage(width, height, Transparency.TRANSLUCENT);



1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
    Graphics2D g2d = (Graphics2D)g;
    int width = 100;
    int height = 100;

    // Create an image that does not support transparency
    BufferedImage bimage = g2d.getDeviceConfiguration().createCompatibleImage(
        width, height, Transparency.OPAQUE);

    // Create an image that supports transparent pixels
    bimage = g2d.getDeviceConfiguration().createCompatibleImage(
        width, height, Transparency.BITMASK);

    // Create an image that supports arbitrary levels of transparency
    bimage = g2d.getDeviceConfiguration().createCompatibleImage(
        width, height, Transparency.TRANSLUCENT);


1  
2  
3  
4  
BufferedImage bimage = (BufferedImage)component.createImage(width, height);
if (bimage == null) {
    // The component is not visible on the screen
}



Offline Alan_W

JGO Knight


Medals: 8
Projects: 3


Java tames rock!


« Reply #1 - Posted 2011-02-15 07:08:33 »

Generally 24 bit RGB and 32 bit ARGB_PRE  bitmaps work ok and use less code than create_compatible_bitmap. Avoid non-premultiplied ARGB.

OSX tends to antialias by default, while windows does not, so OSX can be slower resizing images.

Text rendering was very slow on Java 1.4.2 and Java 5 on OSX, so consider caching any text that is drawn every frame.  Part of my problem was I was rendering text on to an image where I was already writing to the raster.  See next point.  I think the situation is better if you do everything in Java2D on the GPU.  Can't say for Java 6 as I don't have it.

Try to avoid a mix of Java2D and direct raster manipulation on a bitmap.  On Java 1.4.2 it kept swapping the bitmap between the GPU and CPU memory, converting formats.  Often it failed to do this correctly.  Java 5 appeared to have improved this a bit with regards to errors, but still slow.

My current experience is that my powerbook A4 (PPC) is 4 to 5 times slower than my windows 7 Core Duo.  The latest desktop macs seem to be faster and I got closer to parity performance on a borrowed machine.

Time flies like a bird. Fruit flies like a banana.
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #2 - Posted 2011-02-15 16:17:08 »

The latest desktop macs seem to be faster and I got closer to parity performance on a borrowed machine.
I don't know about the desktops, but my very new laptop works terribly on pretty much every applet. I'm pretty convinced it's some kind of bug rather than anything else, but I basically get 2 FPS on 90% of the 4k games.

See my work:
OTC Software
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Hansdampf

Senior Devvie


Projects: 3


too offending?


« Reply #3 - Posted 2011-02-15 18:18:15 »

Some months ago I spent a lot of hours to find the reason. Some simple things (I don't remember exacty which ones) in awt like drawImage/setColor took 100 times longer than on other operating systems.
1  
-Dapple.awt.graphics.UseQuartz=false

fixed it in 1.5, not sure about Java 6 (IIRC).
With webstart there were no problems. Stupid that you can't pass args in the applet tag on OS X


lots of sillystupid games: http://www.emaggame.com
Offline pjt33
« Reply #4 - Posted 2011-02-15 22:40:14 »

The latest desktop macs seem to be faster and I got closer to parity performance on a borrowed machine.
I don't know about the desktops, but my very new laptop works terribly on pretty much every applet. I'm pretty convinced it's some kind of bug rather than anything else, but I basically get 2 FPS on 90% of the 4k games.
Doing better than me - I think mine's the only one that even starts on my Ubuntu box. I'm beginning to suspect that pack200 is broken in the version of Java I have installed.
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.

PocketCrafter7 (12 views)
2014-11-28 16:25:35

PocketCrafter7 (7 views)
2014-11-28 16:25:09

PocketCrafter7 (8 views)
2014-11-28 16:24:29

toopeicgaming1999 (74 views)
2014-11-26 15:22:04

toopeicgaming1999 (64 views)
2014-11-26 15:20:36

toopeicgaming1999 (15 views)
2014-11-26 15:20:08

SHC (29 views)
2014-11-25 12:00:59

SHC (27 views)
2014-11-25 11:53:45

Norakomi (32 views)
2014-11-25 11:26:43

Gibbo3771 (28 views)
2014-11-24 19:59:16
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

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
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!