by Thorsten Mann <atlanx@[EMAIL PROTECTED]
>
Jun 5, 2007 at 07:47 PM
Misterysword@[EMAIL PROTECTED]
schrieb:
> Hi! I have got a program that it shows some scenes (I draw the scene,
> I erase it, and I draw another scene...).
>
> The problem is the flicker. I know that I must use the method of
> double buffer.
>
> How would you do this method? (implementation)-->An example code,
> please!!!
>
> Regards!!!
>
Hello.
1] Probably you don't have to use double buffering
Have a look at:
public final class WakeupOnElapsedFrames extends WakeupCriterion
You can use it to let your application only paint on a new
frame: private WakeupCondition trigger = new WakeupOnElapsedFrames(0);
-> see link to java tutorial at bottom
2] You are sure that it is a painting problen and not
a garbage collection inducted problem?
Run your programm with this java command line
java -verbose:gc <programmname>
If the your programm flickers at the same time as
you see Garbage Collector output then you should
try to avoid objects generated and then garbage collected:
Read Java 3D Tutorial: chapter 4 page 4-8..4-10
http://java.sun.com/developer/onlineTraining/java3d/
and some thougts about garbage collection (in German)
http://www.performance-tips.de/speicherumsatz.html