Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (581)
games submitted by our members
Games in WIP (500)
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  
  24bits performances  (Read 1672 times)
0 Members and 1 Guest are viewing this topic.
Offline SoulSpirit

Junior Newbie




Java games rock!


« Posted 2004-10-05 10:48:57 »

Hi, i wrote a simple 2d test application that displays 100 copies of the same tile, loaded by ImageIO.read().
I made 2 copies of the image file:
- a transparent GIF (8bits)
- a transparent PNG (24bits)

The problem is that when i render the scene using the GIF tile i reach about 900fps, when i use the PNG i get only 22fps.

The only optimization I'm explicitly using, is the double buffering.
I tried to load my tile into a VolatileImageObject, but the result doesn't change, I think that JDK 1.5 automatically loads the tile in the video memory.

Can anyone help me? thanks.
Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #1 - Posted 2004-10-05 10:54:38 »

System.setProperty("sun.java2d.translaccel","true");
System.setProperty("sun.java2d.accthreshold", "0");
System.setProperty("sun.java2d.ddscale","true"); //*
System.setProperty("sun.java2d.ddforcevram", "true");

(* = scaling is either filtered or not... depends on the graphic card)

And it's 32 bit. 8 bit for each channel (red, blue, green and alpha).

弾幕 ☆ @mahonnaiseblog
Offline Mikael Grev

Junior Member




Appearance is everything!


« Reply #2 - Posted 2004-10-05 11:52:05 »

PNG loading with ImageIO is broken for some images. It probably arranges the bits in some not so favourable way. Sun knows about it and i guess? they are working on it.

* Use Toolkit to load the png and you'll see a big improvement.

or

You can also just make a new BufferedImage and copy the old one to the new one and the speed is up there again.


You will still have to use the:

System.setProperty("sun.java2d.translaccel","true");
(or start with -Dsun.java2d.translaccel=true)

to get some real speed with translucent images though.

Cheers,
Mikael

Mikael Grev.
www.migcalendar.com - Advanced Calendar Component
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline dranonymous

Junior Member




Hoping to become a Java Titan someday!


« Reply #3 - Posted 2004-10-05 13:58:37 »

Is anyone interested in making a more substantial graphics tester?  I posted one here -

Other Thread

It would nice to have an app that would give you options such as -

- Full screen vs windowed
- Setting various system properties such as transAccel
- Doing pageFlipping vs VolatileImage

Having one app that people could use to see what modes seem to give them trouble and which don't seems like a useful tool to me.

Dr. A>
Offline SoulSpirit

Junior Newbie




Java games rock!


« Reply #4 - Posted 2004-10-05 18:33:48 »

Thanks, I almost solved the problem copying the BufferedImage into another BufferedImage and setting that 4 system properties.

I tried to use Toolkit to load the image but I couldn't do it... it doesn't load anything and doesn't throw any Exception.....
Image image = Toolkit.getDefaultToolkit().createImage( myPNGFile.toURL() );

So, now i get 200fps that is better than the old 22 fps, but a lot slower than the 900fps i got loading an 8bits GIF!
Offline Mikael Grev

Junior Member




Appearance is everything!


« Reply #5 - Posted 2004-10-05 22:57:37 »

If you copy it you don't have to use toolkit. You can use either. And you should use:

Image image = Toolkit.getDefaultToolkit().getImage( myPNGFile.toURL() );

If you want to use toolkit to load the image.

Make sure that you get an accelerated (called managed) BufferedImage to copy to. If you use 1.5 you'll always get one, for 1.4 only about half of the different approaches to get a new BufferedImage will return a managed one. Look at Chet Haase's articles for more info on images. There at:

http://community.java.net/javadesktop/

a i bit down.

Cheers,
Mikael

Mikael Grev.
www.migcalendar.com - Advanced Calendar Component
Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #6 - Posted 2004-10-06 03:51:53 »

> So, now i get 200fps that is better than the old 22 fps, but
> a lot slower than the 900fps i got loading an 8bits GIF!

"A lot" slower huh? Well, you do much more there so of course it's slower. 4 bytes instead of one. Read back, multiply yadda yadda instead of a simple check.

I mean... you aren't surprised that running 500m takes longer than running 100m right? Tongue

弾幕 ☆ @mahonnaiseblog
Offline trembovetski

Senior Member




If only I knew what I'm talking about!


« Reply #7 - Posted 2004-10-06 05:11:41 »

In theory once the images get accelerated, there shouldn't be any difference between 8 and 24-bit images. But in this case our code uses different mechanisms for accelerating these types of images, which may be the reason for the performance difference.
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.

xsi3rr4x (64 views)
2014-04-15 18:08:23

BurntPizza (62 views)
2014-04-15 03:46:01

UprightPath (75 views)
2014-04-14 17:39:50

UprightPath (58 views)
2014-04-14 17:35:47

Porlus (76 views)
2014-04-14 15:48:38

tom_mai78101 (101 views)
2014-04-10 04:04:31

BurntPizza (161 views)
2014-04-08 23:06:04

tom_mai78101 (256 views)
2014-04-05 13:34:39

trollwarrior1 (209 views)
2014-04-04 12:06:45

CJLetsGame (216 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
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!