Author Topic: SOLVED: Unexpected swing behavior  (Read 2459 times)

Offline Leandro

  • byte
  • *
  • Posts: 3
    • View Profile
SOLVED: Unexpected swing behavior
« on: June 04, 2009, 09:54:21 pm »
Quote
It seems to be a Linux (and Solaris) issue.

In some situations, Java was storing images on pixmaps instead of system memory.
The switch "-Dsun.java2d.pmoffscreen=true" force Java to don't use pixmaps.

Here are some useful links if anyone is experimenting this type of problem: http://java.sun.com/javase/6/docs/technotes/guides/2d/flags.html and http://java.sun.com/products/java-media/2D/perf_graphics.html

Now, lets go to the next round  :)


Hi,

I was doing some experiments. First I removed a lot of code of the fps demo except the fps (frames per second) measurement.
Everyhing works fine. I've got about 160...170 frames per second on a totally black screen at 640x480 using the software renderer.

Then I modified the code to render in a JPanel. Now I have a JPanel with exactly same size of the JFrame (640x480). Again, everything works as expected.

When I resized the screen vertically (i.e. dragging down the bottom border) showing a piece of the JFrame behind the panel, I have no problem and the fps are the same.

But...

If I resize the screen horizontally (i.e. dragging the right border), the fps drops to 80...85  :-[

In my tests, all the time I have a frame bigger than my rendering panel (but only if horizontally), the fps drops a half.

Anyone have an ideia about what could cause this problem?

Thank you,
Leandro
« Last Edit: June 04, 2009, 11:24:02 pm by drung »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Unexpected swing behavior
« Reply #1 on: June 04, 2009, 10:01:13 pm »
SUN added some "improvements" to the 2D pipeline with Java6 Update 10. It causes bad performance on some machines when blitting BufferedImages. Which version are you using? If its U10 or higher, try this switch: -Dsun.java2d.d3d=false


Offline Leandro

  • byte
  • *
  • Posts: 3
    • View Profile
Re: Unexpected swing behavior
« Reply #2 on: June 04, 2009, 10:47:20 pm »
The version I'm using is Java6 Update 13.
I tried the "-Dsun.java2d.d3d=false" and the problem remains.

But I tried some different configurations and I found one that works: -Dsun.java2d.pmoffscreen=true

I'll take more information about this and try to understand what happens  :)

Thank you for your tip. It gave me a direction.