I have 2D elements I draw with postRender() on a Java3D canvas and want to animate these elements. In a loop I call Canvas3D.repaint():
while(animationIsRunning){
// I update positions of 2D elements here...
// ...
canvas3D.repaint();
Thread.sleep((long)(1.0/30.0 * 1000));
}
For every short animation, this causes the whole 3D canvas to flicker once or twice.
I think I found a solution in my case:
Instead of
canvas3d.repaint();
I invoke
canvas3d.getView().repaint();
This way I can update my animation with high framerate without flickering.