Re: Smooth running applet
On 2 Jul 2003 01:49:11 -0700, firstname.lastname@example.org (dr) wrote or quoted :
>I) The animation is not synchronized with the monitor refresh rate.
>II) The animation works fine on my machine, but might not do so on
Make sure you have Swing's setDoubleBuffered( true ).
If you want it really fast, you will need VolateImages. See
http://mindprod.com/image.html. I'm a contract programmer and I could
create you code to do that.
There you buffer, but your buffer is inside the regen memory of the
video card already in video card native format. When it is ready you
blast it onscreen using the 128-bit blt/blt hardware. This is all
done in pure java with the new VolatileImage class.
Your problem may come from starting a new frame before the last one is
finished. Monitor than with the boolean drawImage emits on each pass
of your paintComponent method. You can use a wait/notify to ensure
you finish one frame before you start another.
also setOpaque(true) will suppress background repaint flicker.
Read my essay on Image. My own code runs way more smoothly without
artifacts now I understand how it all works under the hood.
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
|All times are GMT. The time now is 04:27 AM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.