Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
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  
  Accelerated (transparent) images once again...  (Read 2151 times)
0 Members and 1 Guest are viewing this topic.
Offline KnisterPeter

Senior Newbie

Java games rock!

« Posted 2005-06-15 16:26:21 »

Hi there.
I want to load images and have them hw accelerated. I've read many tutorials, the JavaDoc and the forum topics here and think I have done everything correct, but my images are never gets accelerated.
Am I missing something? Below is my code for image loading if anyone could give me a hint:

This one is my the real image loading (my codec files):

This one manages the resource for my engine:
        this.image = (BufferedImage) this.codec.decode(this.location);
        ImageCapabilities ic = this.image.getCapabilities(this.image
        Core.getLogger().info("Image locat: " + this.location);
        Core.getLogger().info("Image accel: " + ic.isAccelerated());
        Core.getLogger().info("Image volat: " + ic.isTrueVolatile());

        GraphicsConfiguration gc = GraphicsEnvironment
        BufferedImage accelImage = gc.createCompatibleImage(this.image
                .getWidth(), this.image.getHeight(), this.image

        Graphics2D g2 = accelImage.createGraphics();
        g2.drawImage(this.image, 0, 0, null);
        ic = accelImage.getCapabilities(accelImage.createGraphics()

        Core.getLogger().info("AccelImage locat: " + this.location);
        Core.getLogger().info("AccelImage accel: " + ic.isAccelerated());
        Core.getLogger().info("AccelImage volat: " + ic.isTrueVolatile());

But any of the debug outputs give no acceleration and no volatile on output.  Sad

Offline kevglass

« JGO Spiffy Duke »

Medals: 319
Projects: 25
Exp: 22 years

Coder, Trainee Pixel Artist, Game Reviewer

« Reply #1 - Posted 2005-06-15 16:32:55 »

If you're transparency from the image is coming back as more than BITMASK the images won't get accelerated on most platforms (without setting certain flags).

Try setting the transparency of your created compatible image to BITMASK.


Offline KnisterPeter

Senior Newbie

Java games rock!

« Reply #2 - Posted 2005-06-15 16:49:09 »

I've tried so.
I also tried Transparency.OPAQUE
as well as setting these system properties:

But nothing has given me an accelerated image.
Not to forget: I'm using WindowsXP

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline trembovetski

Senior Devvie

If only I knew what I'm talking about!

« Reply #3 - Posted 2005-06-16 02:18:11 »

In order for image to get "accelerated" it needs to be copied to an accelerated surface (either
a VolatileImage or screen) several times.

Just create a scratch VolatileImage, and copy your image a couple of times onto
that image prior to checking the isAccelerated() property.

Also, if I recall correctly, there were a couple of bugs in 1.5 such that it'd always report the image
as not being accelerated =( But may be I'm confusing that with recently fixed mustang-specific bugs.

Java2D Team
Offline KnisterPeter

Senior Newbie

Java games rock!

« Reply #4 - Posted 2005-06-16 15:40:50 »

Hmm. Either there is a bug in the isAccelerated() method as you mentioned, or my images don't get accelerated.  Sad
In my short test I load an image with ImageIO and then create a VolatileImage from the default GraphicsConfiguration.
After that I copied the BufferedImage 20 times to the VolatileImage, but the VolatileImage was not accelerated...

[Edit]: But I checked the BufferedImage wich was reported as accelerated. Thanks for your help[/Edit]

Offline KnisterPeter

Senior Newbie

Java games rock!

« Reply #5 - Posted 2005-06-16 17:01:56 »

Another addition:
I only get an accelerated transparent (translucent) image if I set translaccel to true (as documented).
But withou also specifying 'sun.java2d.accthreshold=0' I got no acceleration. Is this the normal behaviour (I use the opengl rendering pipe).
This occurs on jdk 1.5 as well as jdk 1.6-ea.

Offline Linuxhippy

Senior Devvie

Medals: 1

Java games rock!

« Reply #6 - Posted 2005-06-16 17:54:45 »

yes, its a bug (don't have the ID handy).

VIs with alpha-values could be accerlated, but currently are not :-(
I think this will be fixed till mustang release..

lg Clemens
Pages: [1]
  ignore  |  Print  

EgonOlsen (42 views)
2018-06-10 19:43:48

EgonOlsen (22 views)
2018-06-10 19:43:44

EgonOlsen (43 views)
2018-06-10 19:43:20

DesertCoockie (197 views)
2018-05-13 18:23:11

nelsongames (124 views)
2018-04-24 18:15:36

nelsongames (123 views)
2018-04-24 18:14:32

ivj94 (863 views)
2018-03-24 14:47:39

ivj94 (125 views)
2018-03-24 14:46:31

ivj94 (768 views)
2018-03-24 14:43:53

Solater (140 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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!