Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (616)
Games in Android Showcase (173)
games submitted by our members
Games in WIP (659)
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 2043 times)
0 Members and 1 Guest are viewing this topic.
Offline SoulSpirit

Junior Newbie

Java games rock!

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

Hi, i wrote a simple 2d test application that displays 100 copies of the same tile, loaded by
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: 2

pixels! :x

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

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 Devvie

Appearance is everything!

« Reply #2 - Posted 2004-10-05 09: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.


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:

(or start with -Dsun.java2d.translaccel=true)

to get some real speed with translucent images though.


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

Junior Devvie

Hoping to become a Java Titan someday!

« Reply #3 - Posted 2004-10-05 11: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 16: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 Devvie

Appearance is everything!

« Reply #5 - Posted 2004-10-05 20: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:

a i bit down.


Mikael Grev. - Advanced Calendar Component
Offline oNyx

JGO Coder

Medals: 2

pixels! :x

« Reply #6 - Posted 2004-10-06 01: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 Devvie

If only I knew what I'm talking about!

« Reply #7 - Posted 2004-10-06 03: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.

Coldstream24 (19 views)
2015-09-03 00:41:28

Andrew_3ds (31 views)
2015-09-01 19:08:10

afikri (20 views)
2015-08-31 09:30:22

afikri (27 views)
2015-08-31 09:30:07

afikri (15 views)
2015-08-31 09:27:24

afikri (17 views)
2015-08-31 09:26:40

Roquen (32 views)
2015-08-29 11:30:54

GamerC4 (41 views)
2015-08-22 20:38:50

GamerC4 (37 views)
2015-08-22 20:37:18

GamerC4 (43 views)
2015-08-22 20:37:01
HotSpot Options
by Roquen
2015-08-29 11:33:11

Rendering resources
by Roquen
2015-08-17 12:42:29

Rendering resources
by Roquen
2015-08-17 09:36:56

Rendering resources
by Roquen
2015-08-13 07:40:51

Networking Resources
by Roquen
2015-08-13 07:40:43

List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30 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!