Skip to main content

[JAVA3D-INTEREST] ImageComponent2D

1 reply [Last post]
Anonymous

Hello.

I have been setting byReference==true when constructing an
ImageCOmponent2D like this:
ImageComponent2D imageComponent = new ImageComponent2D(
ImageComponent.FORMAT_RGBA, bufferedImage, true, false);
and have been assuming that this would improve performance somehow.

But then I noticed in the profiler that my app was spending 50% of its
time in the copyImage method of ImageComponentRetained. On looking at
the code for the shouldImageBeCopied method within
ImageComponent2DRetained I found that only very specific cases of image
are used by reference, all others are copied.

Is there a simple guiding rule about the kinds of image that can be used
by reference?

Does it actually help performance?
(I just wanna know if I should go to the trouble of switching formats
... :-) )

Appreciate any advice,
-- Russell

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Mike Pilone

Russell,

This is a post from the old mailing list:
http://archives.java.sun.com/cgi-bin/wa?A2=ind0010&L=java3d-interest&P=R...
0&I=-3

It explains when by reference will not result in a copy. The key is to
always have the images be Y-Up and in the proper format. This is dictated by
the underlying OpenGL implementation, not Java3D.

The performance gain depends on your application. If you are constantly
creating new textures and displaying them, then yes the gain will be
significant. If you are just loading a model once, it will probably not be
worth it.

You can get your images in the proper format in your application by creating
a second image and drawing the texture into the new image using a transform
to flip it. Then you can try a quick time comparison when you create your
ImageComponents.

-mike

> -----Original Message-----
> From: Russell East [mailto:reast@esri.com]
> Sent: Friday, November 12, 2004 12:21 PM
> To: interest@java3d.dev.java.net
> Subject: [JAVA3D-INTEREST] ImageComponent2D "by reference"
>
> Hello.
>
> I have been setting byReference==true when constructing an
> ImageCOmponent2D like this:
> ImageComponent2D imageComponent = new ImageComponent2D(
> ImageComponent.FORMAT_RGBA, bufferedImage, true, false);
> and have been assuming that this would improve performance somehow.
>
> But then I noticed in the profiler that my app was spending 50% of its
> time in the copyImage method of ImageComponentRetained. On looking at
> the code for the shouldImageBeCopied method within
> ImageComponent2DRetained I found that only very specific cases of image
> are used by reference, all others are copied.
>
> Is there a simple guiding rule about the kinds of image that can be used
> by reference?
>
> Does it actually help performance?
> (I just wanna know if I should go to the trouble of switching formats
> ... :-) )
>
> Appreciate any advice,
> -- Russell
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
> For additional commands, e-mail: interest-help@java3d.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net