Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Rendering stuck moving back from passive to active rendering



Hi

I am maintaining an existing Java Full Screen Mode application. It's
structured in two parts: a menu which uses Swing and is passively
rendered, and a "game" section which uses Java 2D and is actively
rendered with a BufferStrategy. 

PROBLEM

On the Mac platform we cannot return to the Swing menu. The screen
sticks on the last rendered frame from the game, even though the Swing
menu is actually working underneath - the mouse cursor changes when
moving over (invisible) buttons, clicking fires the right events, and
our overridden paintComponent() method IS being called by the AWT
system. Swing's graphics calls never seem to make it to the screen.

I've run out of ideas to try to get it working. I'd appreciate any
insight or ideas anyone can offer. Has anyone come across this problem
before? Is it a bug in the Mac AWT/2D implementation or is there a
workaround?

EXAMPLE

I've knocked up a small rough app which recreates the problem. It can be
downloaded here:

http://munckfish.net/tmp/MacFSEMBug1.zip

Use the macrun.sh script to build and run using Ant.

After starting the actively rendered part, click the mouse anywhere to
(try and) return to the menu.

We only have Mac OS X 10.4 here I'd be interested to know if the same
problem occurs on 10.5.

OBSERVATIONS

After running the 'game' section and returning to the menu it is
possible click the button and restart the 'game' animation. Even though
the menu never actually gets rendered again.

The frame's background is not painted automatically on Mac. On Win32 and
Linux I don't have to paint a background when moving into the game
because it happens automatically. On Mac it leaves the last repaint of
the menu underneath. Obviously this is easily solved but does show a big
difference in behaviour.

THINGS WE'VE TRIED

These are some the thing I've tried so far without success:

  * Try using the same BufferStrategy all the way through the app.
Currently the Game creates a new one every time it starts.

  * Force creation of a new BufferStrategy before restarting the Swing
bit. I was hoping this would clear the previous native screen buffers
and allow the Swing side to get running again. It didn't.

  * Call paintImmediately() on the Swing panel. No effect. Anyway paint
calls are being received on the Panel but the graphics are not making it
to the screen.

  * Various combinations of Toolkit.sync(), adding and removing
components, JRootPane's etc.

The only thing which does sort of work is to use different frames for
the two parts of the application. Unfortunately this means swapping the
fullscreen window as we change back and forth which results in an ugly
temporary drop to the desktop in between. This makes it look like our
app has crashed which obviously isn't acceptable.

Cheers

Dan Munckton


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.