Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (623)
Games in Android Showcase (176)
games submitted by our members
Games in WIP (676)
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 1376 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: 272
Projects: 25
Exp: 18 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  
You cannot reply to this message, because it is very, very old.

BurntPizza (5 views)
2015-10-07 17:15:53

BurntPizza (23 views)
2015-10-07 02:11:23

KaiHH (23 views)
2015-10-06 20:22:20

KaiHH (11 views)
2015-10-06 19:41:59

BurntPizza (25 views)
2015-10-06 19:04:48

basil_ (44 views)
2015-09-30 17:04:40

shadowstryker (22 views)
2015-09-29 15:55:06

TheSpaceHedgehog (28 views)
2015-09-29 01:58:48

GamerC4 (54 views)
2015-09-24 21:10:38

GamerC4 (71 views)
2015-09-24 21:09:48
Math: Inequality properties
by Roquen
2015-10-01 13:30:46

Math: Inequality properties
by Roquen
2015-09-30 16:06:05

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