Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (777)
Games in Android Showcase (231)
games submitted by our members
Games in WIP (856)
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  
  Swing buffering / window switching bug  (Read 2344 times)
0 Members and 1 Guest are viewing this topic.
Offline ecurtz

Senior Newbie





« Posted 2004-07-19 15:33:40 »

Has anybody else noticed Swing restoring from the wrong portion of the backbuffer if it isn't the foreground application? This seems to be Windows only (OS X has a real back buffer now.) but if I drag a window in front of my applet I can see it restoring content from the origin of my window rather than the portion that needs to be repainted.

Anybody else run into this? I can't seem to catch it as it messes up. My partial hack has been to force a repaint on paintImmediately if I'm not in the foreground (also a hack since an applet can't check if it is in the foreground) but it still nails me with an incorrect redraw shortly after my window becomes frontmost again.

It would be a major pain to post all the code involved, just hoping maybe one of you had seen this and found a solution.

<edit> changed title to be slightly more descriptive </edit>
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #1 - Posted 2004-07-20 03:30:14 »

YES.  I've seen it many times.  I suspect it is someting to do with Direct Draw acceleration code that is running behind the scenes.. like blitting from a volatile image that lost it's contents.

Offline ecurtz

Senior Newbie





« Reply #2 - Posted 2004-07-21 21:13:21 »

Here's a somewhat better description of the problem. It only happens when using Swing componenets in the applet.

I select a window other than my applet and drag it across the applet. As I do this the plugin seems to be accumulating dirty rectangles of the obscured areas. Then I select the applet window and it comes to the front. After a short time (but often AFTER my next repaint) the plugin copies from the origin of the back buffer into the collected dirty area. Thus if I've dragged over the applet window origin it flashes, but is ok, otherwise it draws misaligned junk.

I've tried every method I can think of to validate or invalidate the stuff from the Java side AND I've tried invalidating the Windows window that contains the applet from a JNI call, but nothing seems to fix this. If anybody has a solution to this I'll be eternally grateful and/or bribe you in some way. It's driving me nuts.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline barfy

Junior Devvie




The evidence of things not seen


« Reply #3 - Posted 2004-07-21 23:48:55 »

Your problem sounds similar to the one in this thread:

http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=2D;action=display;num=1087912718

Are you transforming the graphics context in your code?
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #4 - Posted 2004-07-22 12:47:53 »

No, that thread was about me being dumb. Smiley

What I have seen is graphics from some completely different component - I think sometimes even including data from non-java windows that gets blitted into a dirty region.


BTW.. has anyone noticed components not painting at all in low-memory (Java heap, not system) situations?  I have a UI that starts to not paint components at all and the CPU usage skyrockets if the heap usage approaches 64MB...  This happens when I am blitting a large NTSC-video size image or two.   I get the feeling that it is stuck in a loop trying to get a volatile image's contents to stick.
Oops... didn't mean to thread-jack.

Offline ecurtz

Senior Newbie





« Reply #5 - Posted 2004-07-22 14:04:40 »

I thought it was the transform, as I am setting it. However I am restoring it everywhere it gets changed and I still see the problem even if I comment out anything that even looks like a transform. It might be this bug, or a variation thereof:

Redraw problems when moving window over Swing component

I haven't seen it stop painting completely yet, but I look forward to it.  Tongue
Offline z.e.r.o

Junior Devvie




Java games rock!


« Reply #6 - Posted 2004-07-26 02:30:29 »

May be a driver issue? Never noticed that so far...

Matteo Anelli
.brain - http://www.dot-brain.com
Pages: [1]
  ignore  |  Print  
 
 

 
hadezbladez (294 views)
2018-11-16 13:46:03

hadezbladez (164 views)
2018-11-16 13:41:33

hadezbladez (295 views)
2018-11-16 13:35:35

hadezbladez (75 views)
2018-11-16 13:32:03

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

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

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

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

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

nelsongames (2278 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46
java-gaming.org 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‑gaming.org
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!