Hi Mark,

On Sep 13, 2006, at 7:40 PM, [EMAIL PROTECTED] wrote:
Hi all,

I am currently trying to modify an application which displays an
image with various Java2D primitives rendered over it in the middle
of a JFrame, with various Swing components around the edges of the
JFrame (a JMenuBar and two JToolbars to be precise). This app is
run on both Solaris and Windows environments.

This currently runs very slowly, as I am rendering up to 5000
various shapes onto the 2000 x 2000 pixel image.

What kind of image is this?  Is it a BufferedImage?  If so, then you
won't be getting any hardware acceleration when rendering to the
BufferedImage (we only use software loops for that purpose).

Are you rendering the 5000 shapes to the image just once, or is the
image being constantly updated (like in an animated fashion)?

I have created a proof of concept using a BufferStrategy and
enabling the OpenGL pipeline, and (without any Swing components)
the performance increased by ten times (!).


If you render into a BufferStrategy with the OpenGL pipeline enabled,
then you will get hardware acceleration, unlike in the BufferedImage
case.

Now my issue is this - how do I control the image rendering to
enable hardware rendering, but still have Swing components on the
same JFrame? Should I be manually handling VolatileImages instead
of using a BufferStrategy?

BufferStrategy is a heavyweight concept, so you may run into problems
if you try to drop e.g. an AWT Canvas with a BufferStrategy into a
JFrame.

The Swing backbuffer already uses a VolatileImage, so any rendering
you do into the Swing backbuffer will be hardware accelerated.  Have
you tried rendering into the Swing backbuffer?  For most applications
this is sufficient, and you get hardware acceleration basically for
free (without manually dealing with VolatileImages, which can
sometimes be tricky).  But the answer to this may depend on my
question above about whether the image is being constantly updated,
or just updated a few times.

Should I be waiting until Mustang is released?

The above advice applies to any release, but if you want to rely on
the OpenGL pipeline, then JDK 6 is a better bet (the OGL pipeline is
much more stable and performant in that release than it was in JDK 5).

Hope this helps,
Chris


I have been reading articles and forums for 2 days now and still am
stuck - any help would be greatly appreciated.

Thanks

Mark
[Message sent by forum member 'markgrantham' (markgrantham)]

http://forums.java.net/jive/thread.jspa?messageID=152939

======================================================================
=====
To unsubscribe, send email to [EMAIL PROTECTED] and include in
the body
of the message "signoff JAVA2D-INTEREST".  For general help, send
email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to